Skip to content

Class IrisException

Javadoc 27 generates this reference during each site build from the exported packages and the annotation processor. The Java guide shows the API in use.

All Implemented Interfaces:
Serializable
public final class IrisException extends RuntimeException
Thrown for an error in a reader spec, or in an input that a reader spec reads.

origin(), line() and column() give the location that Throwable.getMessage() shows: the one in the input if the error has it, and otherwise the one in the reader spec. error gives both.

An error from a reader spec that a spec builder made also names the line of the host program that wrote the statement the error belongs to: callSite returns it, and Throwable.getMessage() ends with it.

  • Constructor Details

    • IrisException

      public IrisException(IrisError error)
      Creates an exception reporting error.
      Parameters:
      error - the details of the error
  • Method Details

    • error

      public IrisError error()
      Returns the details of the error.
      Returns:
      the details of the error
    • code

      public ErrorCode code()
      Returns the stable code of the error.
      Returns:
      the stable code of the error
    • origin

      public @Nullable String origin()
      Returns the name of the source, or null if the error does not report one.
      Returns:
      the name of the source, or null if the error does not report one
    • line

      public @Nullable Integer line()
      Returns the line, counted from 1, or null if the error does not report one.
      Returns:
      the line, counted from 1, or null if the error does not report one
    • column

      public @Nullable Integer column()
      Returns the column in bytes, counted from 1, or null if the error does not report one.
      Returns:
      the column in bytes, counted from 1, or null if the error does not report one
    • path

      public @Nullable List<Integer> path()
      Returns the indices of a failed check's witness, or null for any other error.
      Returns:
      the indices of a failed check's witness, or null for any other error
    • callSite

      public Optional<StackTraceElement> callSite()
      Returns the line of the host program that wrote the statement the error belongs to, if the reader spec comes from a spec builder.

      It is the statement's BuildException.callSite. A reader spec parsed from text has no call sites, and neither has an error that belongs to no statement, such as unexpected input after the end of the spec.

      Returns:
      the line of the host program that wrote the statement the error belongs to, if the reader spec comes from a spec builder