Class LiteRtException
- Namespace
- LiteRtLmSharp
- Assembly
- LiteRtLmSharp.dll
Raised when a LiteRT-LM native call fails.
public class LiteRtException : Exception, ISerializable
- Inheritance
-
LiteRtException
- Implements
- Derived
- Inherited Members
Remarks
When the native runtime reports why a call failed, the message carries that reason (for example
litert_lm_engine_create returned null: INVALID_ARGUMENT: …) and StatusCode holds
its status, for blocking calls and streamed replies alike. Failures detected by the binding itself, and
native failures that report no status, leave StatusCode null. With the native log
silenced (SetMinLogLevel(int) above 5) some failures keep their status but lose
their reason.
Constructors
LiteRtException(string)
Creates the exception with a message describing the native failure.
public LiteRtException(string message)
Parameters
messagestring
LiteRtException(string, LiteRtStatusCode)
Creates the exception with a message and the status the native runtime reported.
public LiteRtException(string message, LiteRtStatusCode statusCode)
Parameters
messagestringstatusCodeLiteRtStatusCode
LiteRtException(string, Exception)
Creates the exception with a message and the underlying exception that caused it.
public LiteRtException(string message, Exception innerException)
Parameters
Properties
StatusCode
Gets the status the native runtime reported for the failed call, or null when it reported
none or the binding detected the failure itself.
public LiteRtStatusCode? StatusCode { get; }
Property Value
Remarks
Use it to branch on the kind of failure, such as NotFound or InvalidArgument, without parsing the message.