Exceptions#

Patcherโ€™s exception hierarchy.

exception PatcherError(message: str = None, **kwargs)[source]#

Base exception class for Patcher exceptions.

Carries arbitrary keyword context (e.g. status_code=401, url=..., not_found=True) and renders it into the formatted message as message (key1: val1 | key2: val2).

Important

Each keyword in kwargs is also set as an instance attribute (see the loop below). This is load-bearing; multiple callers rely on getattr(err, "not_found", False) to short-circuit on 404 responses (notably during Installomator label fetches). Removing the setattr loop in favor of โ€œjust storing kwargs in self.contextโ€ looks like cleanup but silently breaks the 404 short-circuit. The context dict is preserved separately for the message formatter.

Parameters:

message (str)

format_message() str[source]#

Format exception message properly.

Return type:

str

exception SetupError(message: str = None, **kwargs)[source]#

Raised if any errors occur during automatic setup.

Parameters:

message (str)

exception CredentialError(message: str = None, **kwargs)[source]#

Raised if any errors occur during saving or updating credentials.

Parameters:

message (str)

exception APIResponseError(message: str = None, **kwargs)[source]#

Raised when an API Call receives an unsuccessful status code.

Parameters:

message (str)

exception NotFoundError(message: str = None, **kwargs)[source]#

Raised when an API call returns 404 (resource not found).

A subclass of APIResponseError, so existing except APIResponseError handlers still catch it; new code can except NotFoundError for the 404 case. Always carries not_found=True so the legacy getattr(err, "not_found", ...) short-circuit keeps working.

Parameters:

message (str)

exception TokenError(message: str = None, **kwargs)[source]#

Raised when there is an error fetching, saving or retrieving a bearer token from Jamf API.

Parameters:

message (str)

exception InstallomatorWarning[source]#

Custom warning to indicate InstallomatorClient-related issues.