synology_apm.sdk.exceptions module

APM SDK custom exception hierarchy.

exception synology_apm.sdk.exceptions.APMError(message, error_code=None, response_body=None)

Bases: Exception

Base class for all APM SDK exceptions.

Variables:
  • message – Human-readable error description.

  • error_code – Synology WebAPI or APM REST API error code (if any).

  • response_body – Full JSON response body (for debugging or reporting).

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.AuthenticationError(message, error_code=None, response_body=None)

Bases: APMError

Login failed or session has expired.

Common causes: - Incorrect username or password - Session expired - Account is locked

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.ResourceNotFoundError(message, resource_type, resource_id, error_code=None, response_body=None)

Bases: _ResourceError

The requested resource does not exist.

Variables:
  • resource_type – Resource type name, e.g. “Workload”, “ProtectionPlan”.

  • resource_id – The ID or name used in the lookup.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.PermissionDeniedError(message, error_code=None, response_body=None)

Bases: APMError

The user lacks sufficient permission for this operation.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.NotSupportedError(message, error_code=None, response_body=None)

Bases: APMError

Feature not supported by this APM version.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.InvalidOperationError(message, resource_type, resource_id, error_code=None, response_body=None)

Bases: _ResourceError

The operation is not valid for the resource’s current state.

Variables:
  • resource_type – Resource type name, e.g. “Workload”.

  • resource_id – The ID of the resource.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.ConnectionTimeoutError(message, error_code=None, response_body=None)

Bases: APMError

Raised when APM did not respond within the configured timeout.

Distinct from a connection failure (unreachable host / refused connection): the request was dispatched but no complete response arrived before the timeout expired.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.BackupServerDisconnectedError(message, error_code=None, response_body=None)

Bases: APMError

The operation failed because the designated backup server is disconnected.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.NotManagementServerError(message, error_code=None, response_body=None)

Bases: APMError

The host is not running APM or is not the primary management server.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.ResourceNotReadyError(message, error_code=None, response_body=None)

Bases: APMError

The resource exists but is not yet in a state where the operation can be performed.

Raised when an operation requires the resource to be ready, such as calling get_download_url_by_ready_result() on a result whose ready_to_download is False.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.PlanNameConflictError(message, resource_type, resource_id, error_code=None, response_body=None)

Bases: _ResourceError

A plan with this name already exists.

Raised by create() and update() when the plan name is already taken.

Variables:
  • resource_type – Plan type — “ProtectionPlan”, “RetirementPlan”, or “TieringPlan”.

  • resource_id – The conflicting plan name.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.PlanInUseError(message, resource_type, resource_id, *, has_workloads=False, has_server_template=False, has_backup_servers=False, error_code=None, response_body=None)

Bases: _ResourceError

Cannot delete the plan because it is still assigned to workloads or backup servers.

Variables:
  • resource_type – Plan type — “ProtectionPlan”, “RetirementPlan”, or “TieringPlan”.

  • resource_id – The plan UUID.

  • has_workloads – Workloads are assigned to this plan.

  • has_server_template – The plan is the default template for a backup server (protection plans only).

  • has_backup_servers – Backup servers are assigned to this tiering plan (tiering plans only).

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.DuplicateWorkloadError(message, resource_type, resource_id, error_code=None, response_body=None)

Bases: _ResourceError

A workload with the same identity already exists.

Raised by add_file_server() and update_file_server() when a file server at the given IP address is already registered with the same plan on the same backup server.

Variables:
  • resource_type – Always “file_server”.

  • resource_id – The conflicting file server IP address.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.RemoteStorageConflictError(message, resource_type, resource_id, error_code=None, response_body=None)

Bases: _ResourceError

A remote storage with this vault is already registered.

Raised by add() when the vault is already registered with this APM instance.

Variables:
  • resource_type – Always “RemoteStorage”.

  • resource_id – The vault name that caused the conflict.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.RemoteStorageInUseError(message, resource_type, resource_id, error_code=None, response_body=None)

Bases: _ResourceError

Cannot delete the storage because it is referenced by active plans.

Raised by delete() when the storage is still assigned to protection or tiering plans.

Variables:
  • resource_type – Always “RemoteStorage”.

  • resource_id – The storage UUID.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.RemoteStorageEncryptionMismatchError(message, resource_type, resource_id, error_code=None, response_body=None)

Bases: _ResourceError

The vault was originally registered with encryption; relink_encryption_key is required.

Raised by add() when the vault’s encryption mode does not match the current request — the vault was previously set up with client-side encryption, but the request does not include the encryption key from the original registration.

Variables:
  • resource_type – Always “RemoteStorage”.

  • resource_id – The vault name.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.RemoteStorageUnmanagedCatalogError(message, *, vault_name, catalog_count)

Bases: APMError

The vault contains pre-existing backup catalogs not linked to any plan.

Raised by add() when pre-existing catalogs are detected and no retirement plan was provided in the request. Provide unmanaged_retirement_plan in the add request to relink those catalogs to a retirement plan.

Variables:
  • vault_name – Vault or bucket name where unmanaged catalogs were found.

  • catalog_count – Number of unmanaged catalog entries detected.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception synology_apm.sdk.exceptions.APIError(message, error_code=None, response_body=None)

Bases: APMError

APM REST API returned an error not covered by a more specific exception class.

Report the error_code to the SDK maintainers for finer-grained handling.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.