Class OrtException

  • All Implemented Interfaces:
    java.io.Serializable

    public class OrtException
    extends java.lang.Exception
    An exception which contains the error message and code produced by the native onnxruntime.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  OrtException.OrtErrorCode
      Maps the OrtErrorCode struct in onnxruntime_c_api.h with an additional entry for Java side errors.
    • Constructor Summary

      Constructors 
      Constructor Description
      OrtException​(int code, java.lang.String message)
      Used to throw an exception from native code as it handles the enum lookup in Java.
      OrtException​(OrtException.OrtErrorCode code, java.lang.String message)
      Creates an OrtException using the specified error code and message.
      OrtException​(java.lang.String message)
      Creates an OrtException with a default Java error code and the specified message.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      OrtException.OrtErrorCode getCode()
      Return the error code.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, 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

      • OrtException

        public OrtException​(java.lang.String message)
        Creates an OrtException with a default Java error code and the specified message.
        Parameters:
        message - The message to use.
      • OrtException

        public OrtException​(int code,
                            java.lang.String message)
        Used to throw an exception from native code as it handles the enum lookup in Java.
        Parameters:
        code - The error code.
        message - The message.
      • OrtException

        public OrtException​(OrtException.OrtErrorCode code,
                            java.lang.String message)
        Creates an OrtException using the specified error code and message.
        Parameters:
        code - The error code from the native runtime.
        message - The error message.