Exceptions

The SDK provides the user a list of exceptions that they may use when calling any of the API's methods. This can come in handy when catching errors that will provide more details that are specific to the Brady SDK.

SdkApiException

This is the base exception that will be extended by more specific exceptions (all listed below). Users are encouraged to catch only this base exception since this will successfully catch all other custom exceptions.

PrinterDiscoveryException(message: String)

Thrown when an error occurs related to printer discovery.

PrinterConnectionException(message: String)

Thrown when an error occurs related to printer connection.

TemplateNotLoadedException(message: String)

Thown when an error occurs when attempting to load a template.

InvalidPlaceholderDataException(message: String)

Thrown when an error is caused by invalid data being set to a template placeholder.

TemplateRenderingException(message: String)

Thrown when an error occurs while attempting to render template objects during getPreview() or the print() methods.

PrinterOperationException(message: String)

Thrown when an error occurs while attempting a printer operation such as feed, cut, of setAutomaticShutdownTime.

PrintingException(message: String)

Thrown when an error occurs at print time.

DisconnectionException(message: String)

Thrown when an error occurs while attempting to disconnect from a printer.

UnsupportedPrinterException(message: String)

Thrown when an error related to an incompatibility issue between the SDK and the connected printer occurs. The SDK might not support this printer.