Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
31739b1a
Commit
31739b1a
authored
5 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
export CodedCustomExceptionMetaclass
parent
75f975a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-1
1 addition, 1 deletion
CHANGELOG.md
docs/exceptions.rst
+6
-0
6 additions, 0 deletions
docs/exceptions.rst
satella/exceptions.py
+4
-1
4 additions, 1 deletion
satella/exceptions.py
with
11 additions
and
2 deletions
CHANGELOG.md
+
1
−
1
View file @
31739b1a
# v2.5.10
# v2.5.10
*
_TBA_
*
exported CodedCustomExceptionMetaclass
# v2.5.9
# v2.5.9
...
...
This diff is collapsed.
Click to expand it.
docs/exceptions.rst
+
6
−
0
View file @
31739b1a
...
@@ -75,3 +75,9 @@ Note that this won't allow you to handle exceptions like that
...
@@ -75,3 +75,9 @@ Note that this won't allow you to handle exceptions like that
self.fail()
self.fail()
As this is a Python limitation.
As this is a Python limitation.
The CodedCustomException uses the following metaclass to accomplish
it's magic
.. autoclass:: satella.exceptions.CodedCustomExceptionMetaclass
:members:
This diff is collapsed.
Click to expand it.
satella/exceptions.py
+
4
−
1
View file @
31739b1a
...
@@ -4,7 +4,7 @@ import typing as tp
...
@@ -4,7 +4,7 @@ import typing as tp
__all__
=
[
'
BaseSatellaError
'
,
'
ResourceLockingError
'
,
'
ResourceNotLocked
'
,
'
ResourceLocked
'
,
__all__
=
[
'
BaseSatellaError
'
,
'
ResourceLockingError
'
,
'
ResourceNotLocked
'
,
'
ResourceLocked
'
,
'
ConfigurationValidationError
'
,
'
ConfigurationError
'
,
'
ConfigurationSchemaError
'
,
'
ConfigurationValidationError
'
,
'
ConfigurationError
'
,
'
ConfigurationSchemaError
'
,
'
PreconditionError
'
,
'
MetricAlreadyExists
'
,
'
BaseSatellaException
'
,
'
CustomException
'
,
'
PreconditionError
'
,
'
MetricAlreadyExists
'
,
'
BaseSatellaException
'
,
'
CustomException
'
,
'
CodedCustomException
'
]
'
CodedCustomException
'
,
'
CodedCustomExceptionMetaclass
'
]
class
CustomException
(
Exception
):
class
CustomException
(
Exception
):
...
@@ -47,6 +47,9 @@ def get_base_of_bases(classes):
...
@@ -47,6 +47,9 @@ def get_base_of_bases(classes):
class
CodedCustomExceptionMetaclass
(
type
):
class
CodedCustomExceptionMetaclass
(
type
):
"""
Metaclass implementing the isinstance check for coded custom exceptions
"""
code
=
None
# type: tp.Optional[tp.Any]
code
=
None
# type: tp.Optional[tp.Any]
def
__instancecheck__
(
cls
,
instance
):
def
__instancecheck__
(
cls
,
instance
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment