-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
8 deletions.
There are no files selected for viewing
25 changes: 17 additions & 8 deletions
25
services/storage/src/simcore_service_storage/exceptions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,50 @@ | ||
from pydantic.errors import PydanticErrorMixin | ||
|
||
|
||
class FileMetaDataNotFoundError(PydanticErrorMixin, RuntimeError): | ||
class StorageRuntimeError(PydanticErrorMixin, RuntimeError): | ||
... | ||
|
||
|
||
class DatabaseAccessError(StorageRuntimeError): | ||
code = "database.access_error" | ||
msg_template: str = "Unexpected error while accessing database backend" | ||
|
||
|
||
class FileMetaDataNotFoundError(DatabaseAccessError): | ||
code = "filemetadata.not_found_error" | ||
msg_template: str = "The file meta data for {file_id} was not found" | ||
|
||
|
||
class FileAccessRightError(PydanticErrorMixin, RuntimeError): | ||
class FileAccessRightError(DatabaseAccessError): | ||
code = "file.access_right_error" | ||
msg_template: str = "Insufficient access rights to {access_right} {file_id}" | ||
|
||
|
||
class ProjectAccessRightError(PydanticErrorMixin, RuntimeError): | ||
class ProjectAccessRightError(DatabaseAccessError): | ||
code = "file.access_right_error" | ||
msg_template: str = "Insufficient access rights to {access_right} {project_id}" | ||
|
||
|
||
class ProjectNotFoundError(PydanticErrorMixin, RuntimeError): | ||
class ProjectNotFoundError(DatabaseAccessError): | ||
code = "project.not_found_error" | ||
msg_template: str = "Project {project_id} was not found" | ||
|
||
|
||
class LinkAlreadyExistsError(PydanticErrorMixin, RuntimeError): | ||
class LinkAlreadyExistsError(DatabaseAccessError): | ||
code = "link.already_exists_error" | ||
msg_template: str = "The link {file_id} already exists" | ||
|
||
|
||
class S3AccessError(PydanticErrorMixin, RuntimeError): | ||
class S3AccessError(StorageRuntimeError): | ||
code = "s3_access.error" | ||
msg_template: str = "Unexpected error while accessing S3 backend" | ||
|
||
|
||
class S3BucketInvalidError(PydanticErrorMixin, RuntimeError): | ||
class S3BucketInvalidError(S3AccessError): | ||
code = "s3_bucket.invalid_error" | ||
msg_template: str = "The {bucket} is invalid" | ||
|
||
|
||
class S3KeyNotFoundError(PydanticErrorMixin, RuntimeError): | ||
class S3KeyNotFoundError(S3AccessError): | ||
code = "s3_key.not_found_error" | ||
msg_template: str = "The file {key} in {bucket} was not found" |