-
Notifications
You must be signed in to change notification settings - Fork 0
Improved exception handling #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
508c8fc
Standardized error messages
glpatcern 5ba8f34
Fixed lock handling in write_file
glpatcern 63ed8be
Fixed type in set_xattr
glpatcern f8f393c
Unnest the exceptions package
glpatcern 2acec4e
Better fix for lock metadata handling in write_file
glpatcern 1985cdc
Fixed function signatures to uniformly use Optional[] as type hint wh…
glpatcern 897250d
Do not force a type conversion as the type is hinted in the signature
glpatcern 6d46363
Introduced a permission denied exception
glpatcern 3501beb
Merge branch 'main' into exception-handling
glpatcern ae092cb
One more optional parameter
glpatcern File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
""" | ||
exceptions | ||
|
||
Custom exception classes for the CS3 client. | ||
Where applicable, the default values correspond to the Linux standard error strings. | ||
|
||
Authors: Rasmus Welander, Diogo Castro, Giuseppe Lo Presti. | ||
Emails: [email protected], [email protected], [email protected] | ||
Last updated: 01/08/2024 | ||
""" | ||
|
||
|
||
class AuthenticationException(Exception): | ||
""" | ||
Standard error thrown when attempting an operation without the required access rights | ||
""" | ||
|
||
def __init__(self, message: str = "Operation not permitted"): | ||
super().__init__(message) | ||
|
||
|
||
class NotFoundException(IOError): | ||
""" | ||
Standard file missing message | ||
""" | ||
|
||
def __init__(self, message: str = "No such file or directory"): | ||
super().__init__(message) | ||
|
||
|
||
class SecretNotSetException(Exception): | ||
""" | ||
Standard file missing message | ||
""" | ||
|
||
def __init__(self, message: str = "Secret was not set, unable to authenticate"): | ||
super().__init__(message) | ||
|
||
|
||
class FileLockedException(IOError): | ||
""" | ||
Standard error thrown when attempting to overwrite a file/xattr with a mistmatched lock, | ||
or when a lock operation cannot be performed because of failed preconditions | ||
""" | ||
|
||
def __init__(self, message: str = "Lock mismatch"): | ||
super().__init__(message) | ||
|
||
|
||
class UnknownException(Exception): | ||
""" | ||
Standard exception to be thrown when we get an error that is unknown, e.g. not defined in the cs3api | ||
""" | ||
|
||
def __init__(self, message: str = ""): | ||
super().__init__(message) | ||
|
||
|
||
class AlreadyExistsException(IOError): | ||
""" | ||
Standard error thrown when attempting to create a resource that already exists | ||
""" | ||
|
||
def __init__(self, message: str = "File exists"): | ||
super().__init__(message) | ||
|
||
|
||
class UnimplementedException(Exception): | ||
""" | ||
Standard error thrown when attempting to use a feature that is not implemented | ||
""" | ||
|
||
def __init__(self, message: str = "Not implemented"): | ||
super().__init__(message) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,7 +1,7 @@ | ||
exceptions Module | ||
================= | ||
|
||
.. automodule:: exceptions.exceptions | ||
.. automodule:: exceptions | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.