Package com.snowflake.ingest.streaming
Class SFException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.snowflake.ingest.streaming.SFException
- All Implemented Interfaces:
Serializable
Snowflake exception in the Ingest SDK
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSFException(ErrorCode errorCode, String message) Construct a Snowflake exception using strongly-typed ErrorCode enum (RECOMMENDED)SFException(ErrorCode errorCode, String message, Throwable cause) Construct a Snowflake exception using strongly-typed ErrorCode enum (RECOMMENDED)SFException(String errorCodeName, String message, int httpStatusCode, String httpStatusName) Constructor with explicit error details (FOR FFI USAGE) Use this when you have complete error information including HTTP status code and name. -
Method Summary
Modifier and TypeMethodDescriptionOriginal detail string passed to the constructor, without error-code / HTTP-status decoration.Get the error code nameintGet the HTTP status codeGet the HTTP status code nameLog-friendly message that includes error code and HTTP status.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
SFException
Construct a Snowflake exception using strongly-typed ErrorCode enum (RECOMMENDED)- Parameters:
errorCode- the error code enum valuemessage- the message of the exceptioncause- the cause of the exception
-
SFException
Construct a Snowflake exception using strongly-typed ErrorCode enum (RECOMMENDED)- Parameters:
errorCode- the error code enum valuemessage- the message of the exception
-
SFException
Constructor with explicit error details (FOR FFI USAGE) Use this when you have complete error information including HTTP status code and name. Prefer ErrorCode enum constructors for new Java code when possible.- Parameters:
errorCodeName- the error code namemessage- the message of the exceptionhttpStatusCode- the HTTP status codehttpStatusName- the HTTP status code name
-
-
Method Details
-
getMessage
Log-friendly message that includes error code and HTTP status.Format matches Python
str(StreamingIngestError)and NodeStreamingIngestError#toString():"{errorCodeName}: {detail} (HTTP {code} {name})".This is what
exception.getMessage()and defaulttoString()produce, so bothlogger.error("{}", e.getMessage())andlogger.error("failed", e)include the structured fields.- Overrides:
getMessagein classThrowable
-
getDetailMessage
Original detail string passed to the constructor, without error-code / HTTP-status decoration.Prefer
getMessage()when logging. Use this when a caller needs the undecorated Rust / SDK detail (for example when mapping to a structured error payload that already has separate error-code and HTTP-status fields). -
getErrorCodeName
Get the error code name- Returns:
- the error code name (e.g., \"ConfigError\", \"InvalidArgument\")
-
getHttpStatusCode
public int getHttpStatusCode()Get the HTTP status code- Returns:
- the HTTP status code
-
getHttpStatusName
Get the HTTP status code name- Returns:
- the HTTP status code name (e.g., \"Bad Request\", \"Internal Server Error\")
-