Package jline.io

Class LineException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
LineExternalException, LineInputException, LineInternalException, LineNumericalException, LineUnsupportedException

public class LineException extends RuntimeException
The exception every deliberate LINE diagnostic throws.

It carries NO stack trace of its own. A line_error is a message LINE wrote on purpose and its text already names the caller, so the frames between the throw and whatever the user called (runAnalyzerChecks -> runAnalyzer -> getAvg -> getAvgTable -> ...) are noise: printing them buries a one-sentence refusal such as "finite station capacity at station 'Queue2' is not supported by SolverNC" under a screen of internal frames the user neither chose nor can act on. The JVM's default handler, printStackTrace() and MATLAB's lang='java' bridge then all report the message alone. This mirrors the empty-stack throw of matlab/src/io/line_error.m.

The suppression is decided ONCE, when the exception is constructed, from GlobalConstants.Verbose: at VerboseLevel.DEBUG the trace is writable and the full chain comes back, which is what a developer wants. Genuine JVM faults (IndexOutOfBoundsException, NullPointerException) never come through here and are untouched.

A CAUSE KEEPS ITS OWN TRACE. Only this wrapper's frames are dropped, so the "Caused by:" block of a re-reported failure still points at the line that actually broke -- the whole reason line_error(caller, msg, cause) exists.

It extends RuntimeException, which is what line_error threw before, so every existing catch (RuntimeException) still catches it.

It carries an ErrorId from the cross-codebase vocabulary (_kb/17-error-vocabulary.md); one subclass per category (LineUnsupportedException, LineNumericalException, LineInputException, LineExternalException, LineInternalException) lets a caller catch by category.

See Also:
  • Constructor Details

    • LineException

      public LineException(String message)
      Parameters:
      message - the already-formatted diagnostic
    • LineException

      public LineException(String message, Throwable cause)
      Parameters:
      message - the already-formatted diagnostic
      cause - the failure being re-reported, or null
    • LineException

      public LineException(ErrorId errorId, String message, Throwable cause)
      Parameters:
      errorId - the identifier from the error vocabulary
      message - the already-formatted diagnostic
      cause - the failure being re-reported, or null
  • Method Details

    • create

      public static LineException create(ErrorId errorId, String message, Throwable cause)
      Builds the subclass that matches the id's category, so that catch (LineUnsupportedException e) sees every refusal however it was raised.
    • getErrorId

      public ErrorId getErrorId()
      The identifier, LINE:Error when the diagnostic is unclassified.
    • getIdentifier

      public String getIdentifier()
      The identifier as a string, e.g. LINE:unsupported:Cache.
    • errorIdOf

      public static ErrorId errorIdOf(Throwable t)
      The vocabulary id of any throwable: its own for a LineException, LINE:Error otherwise.