com.mathworks.mps.client

## Class MATLABException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - com.mathworks.mps.client.MATLABException

- All Implemented Interfaces:
    java.io.Serializable

      public class MATLABException
      extends java.lang.Exception

  Represents a MATLAB error. This error can be thrown during the invocation of a MATLAB function associated with a MATLAB Production Server request initiated by `MWHttpClient`. MATLAB makes the following information available in case of an error:
  - MATLAB stack trace
  - Error ID
  - Error message
  `MATLABException` acts as a container for this information and provides public API to get to this information.

  NOTE: Users of MATLAB Production Server Java client won't need to create an instance of this exception class from scratch. It will be thrown only in case of MATLAB error on the server

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MATLABException(java.lang.String message, java.lang.String identifier, java.util.List<MATLABStackFrame> stackList)` Create an instance of `MATLABException` using MATLAB error message, error identifier and a list of `MATLABStackFrame` representing MATLAB stack trace associated with an error in MATLAB.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getMATLABIdentifier()` Returns identifier used when error was thrown in MATLAB
    `java.util.List<MATLABStackFrame>` | `getMATLABStackTrace()` Returns MATLAB stack with 0 or more `MATLABStackFrame`.
    `java.lang.String` | `getMessage()` Returns detailed MATLAB message corresponding to an error
    `void` | `printMATLABStackTrace()` Print `MATLABException`'s MATLAB stack trace to the standard error output stream that is the value of the field System.err
    `void` | `printMATLABStackTrace(java.io.PrintStream s)` Prints `MATLABException`'s MATLAB back trace to the specified `PrintStream`.
    `void` | `printMATLABStackTrace(java.io.PrintWriter s)` Prints `MATLABException`'s MATLAB back trace to the specified `PrintWriter`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MATLABException

          public MATLABException(java.lang.String message,
                                 java.lang.String identifier,
                                 java.util.List<MATLABStackFrame> stackList)

      Create an instance of `MATLABException` using MATLAB error message, error identifier and a list of `MATLABStackFrame` representing MATLAB stack trace associated with an error in MATLAB.
      Parameters:
        `message` - error message from MATLAB
        `identifier` - error identifier used in MATLAB
        `stackList` - list of `MATLABStackFrame` representing MATLAB stack trace. An unmodifiable copy of this list is made

  - ### Method Detail

    - #### getMATLABStackTrace

          public java.util.List<MATLABStackFrame> getMATLABStackTrace()

      Returns MATLAB stack with 0 or more `MATLABStackFrame`. Each stack frame provides information about MATLAB file, function name and line number. The output list of `MATLABStackFrame` is unmodifiable
      Returns:
        A list of `MATLABStackFrame`

    - #### getMessage

          public java.lang.String getMessage()

      Returns detailed MATLAB message corresponding to an error
      Overrides:
        `getMessage` in class `java.lang.Throwable`
      Returns:
        Detailed MATLAB message corresponding to an error

    - #### getMATLABIdentifier

          public java.lang.String getMATLABIdentifier()

      Returns identifier used when error was thrown in MATLAB
      Returns:
        Identifier used when error was thrown in MATLAB

    - #### printMATLABStackTrace

          public void printMATLABStackTrace()

      Print `MATLABException`'s MATLAB stack trace to the standard error output stream that is the value of the field System.err

    - #### printMATLABStackTrace

          public void printMATLABStackTrace(java.io.PrintStream s)

      Prints `MATLABException`'s MATLAB back trace to the specified `PrintStream`.
      Parameters:
        `s` - PrintStream to use for output

    - #### printMATLABStackTrace

          public void printMATLABStackTrace(java.io.PrintWriter s)

      Prints `MATLABException`'s MATLAB back trace to the specified `PrintWriter`
      Parameters:
        `s` - PrintWriter to use for output

Copyright 2010-2022 The MathWorks, Inc.