Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
46d476af
Commit
46d476af
authored
4 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add get_code function for TransactionErrors caused by container
parent
32bfd737
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosdb/exceptions.py
+13
-0
13 additions, 0 deletions
src/caosdb/exceptions.py
with
13 additions
and
0 deletions
src/caosdb/exceptions.py
+
13
−
0
View file @
46d476af
...
...
@@ -257,6 +257,7 @@ class TransactionError(CaosDBException):
self.entities instead.
"""
if
self
.
container
is
not
None
:
return
self
.
container
from
caosdb
import
Container
...
...
@@ -289,6 +290,18 @@ class TransactionError(CaosDBException):
"
This TransActionError was caused by more than one EntityError.
"
)
def
get_code
(
self
):
"""
In the special case of a container with at least one error message
with an integer code, return that code. Return None
otherwise.
"""
if
self
.
container
is
not
None
and
self
.
container
.
get_errors
()
is
not
None
:
for
err
in
self
.
container
.
get_errors
():
if
err
.
code
is
not
None
:
return
err
.
code
def
_repr_reasons
(
self
,
indent
):
if
self
.
get_errors
()
is
not
None
and
len
(
self
.
get_errors
())
>
0
:
ret
=
"
\n
"
+
indent
+
"
+--| REASONS |--
"
...
...
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