Class VmExceptionBuilder


  • public class VmExceptionBuilder
    extends java.lang.Object
    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.)