Package org.pkl.core.runtime
Class VmExceptionBuilder
java.lang.Object
org.pkl.core.runtime.VmExceptionBuilder
Error message guidelines:
- Pkl strives to provide a great experience for casual users. Hence it must excel at error reporting.
- Be concrete and concise. Examples and explanations can help but must carry their weight.
- The source line is considered an integral part of the error message. Assume it's always presented to the user. Design the main message accordingly and avoid duplicated information.
- Use correct "natural language" spelling. Most messages should be sentences that start with an uppercase letter and end with a dot.
- The main message should typically be a single line and sentence. Try to make it both easy
to understand for novices and easy to recognize for experienced users. Use
withHint(java.lang.String)for longer explanations. - Don't include arbitrary-size information in the main message but instead use
withProgramValue(java.lang.String, java.lang.Object). - Use
withExternalMessage(java.lang.String, java.lang.Object...)whenever possible. - Avoid abbreviations (i.e., e.g., etc., ...). Some users will not be familiar with them.
- Use backticks for inline code (cf. Markdown). (For identifiers, *emphasis* may be preferable but isn't currently used. One problem with special formatting is that error output doesn't always go to a terminal and hence may be rendered verbatim.)
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadhocEvalError(String message, Object... args) build()cannotFindKey(VmMap map, Object key) cannotFindMember(VmObjectLike receiver, Object memberKey) cannotFindMethod(VmObjectLike receiver, Identifier methodName, int arity, boolean isImplicitReceiver) cannotFindProperty(VmObjectLike receiver, Identifier propertyName, boolean isRead, boolean isImplicitReceiver) typeMismatch(Object value, VmClass expectedType) typeMismatch(Object value, VmClass expectedType1, VmClass expectedType2) undefinedPropertyValue(Identifier propertyName, Object receiver) withInsertedStackFrames(Map<com.oracle.truffle.api.CallTarget, StackFrame> insertedStackFrames) withLocation(com.oracle.truffle.api.nodes.Node location) withMemberName(String memberName) withOptionalLocation(@Nullable com.oracle.truffle.api.nodes.Node location) withProgramValue(String name, Object value) withSourceSection(@Nullable com.oracle.truffle.api.source.SourceSection sourceSection) wrapping(VmException nestedException)
-
Constructor Details
-
VmExceptionBuilder
public VmExceptionBuilder()
-
-
Method Details
-
typeMismatch
-
typeMismatch
-
unreachableCode
-
undefinedValue
-
undefinedPropertyValue
-
cannotFindMember
-
cannotFindProperty
public VmExceptionBuilder cannotFindProperty(VmObjectLike receiver, Identifier propertyName, boolean isRead, boolean isImplicitReceiver) -
cannotFindMethod
public VmExceptionBuilder cannotFindMethod(VmObjectLike receiver, Identifier methodName, int arity, boolean isImplicitReceiver) -
cannotFindKey
-
bug
-
evalError
-
adhocEvalError
-
withProgramValue
-
withLocation
-
withOptionalLocation
public VmExceptionBuilder withOptionalLocation(@Nullable @Nullable com.oracle.truffle.api.nodes.Node location) -
withSourceSection
public VmExceptionBuilder withSourceSection(@Nullable @Nullable com.oracle.truffle.api.source.SourceSection sourceSection) -
withMemberName
-
withCause
-
withHint
-
wrapping
-
withInsertedStackFrames
public VmExceptionBuilder withInsertedStackFrames(Map<com.oracle.truffle.api.CallTarget, StackFrame> insertedStackFrames) -
build
-