This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/python/exceptions/nutrient-exception.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. NutrientException

Base class for all Nutrient SDK exceptions. Every exception raised by the SDK inherits from NutrientException, so catching it handles any SDK error.

from nutrient_sdk import NutrientException

Inherits from: Exception

try:
document.export_as_pdf("output.pdf")
except NutrientException as error:
print(error) # the message
print(error.error_code) # native error code, if any

Construction

NutrientException(message, error_code=None, error_source=None)

Creates a new NutrientException with the given message and optional native error details.

Properties

message

@property
def message(self) -> str

The error message.

Type: str

Read-only property.


error_code

@property
def error_code(self) -> Optional[int]

The native error code, if any.

Type: Optional[int]

Read-only property.


error_source

@property
def error_source(self) -> Optional[str]

The source location of the error, if any.

Type: Optional[str]

Read-only property.

Methods

has_native_error

def has_native_error(self) -> bool

Returns whether native error details are attached to this exception.

Returns: bool


get_native_details

def get_native_details(self) -> Optional[Dict[str, Any]]

Returns the native error details, if any.

Returns: Optional[Dict[str, Any]]

Inheritors