Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend_api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
videoag
backend_api
Commits
dec99876
Commit
dec99876
authored
Mar 4, 2024
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
py: Bugfixes
parent
aa2e04bf
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/database/database.py
+7
-7
7 additions, 7 deletions
src/api/database/database.py
src/api/objects/object.py
+2
-1
2 additions, 1 deletion
src/api/objects/object.py
with
9 additions
and
8 deletions
src/api/database/database.py
+
7
−
7
View file @
dec99876
...
...
@@ -246,7 +246,7 @@ class AbstractTransaction(ABC):
results
.
append
(
self
.
get_result
(
filled
))
return
tuple
(
results
)
def
_
on_error_close_transaction
(
self
):
def
on_error_close_transaction
(
self
):
# noinspection PyBroadException
try
:
self
.
_connection
.
execute_statements
(
...
...
@@ -264,18 +264,18 @@ class AbstractTransaction(ABC):
results
=
self
.
_connection
.
execute_statements
(
self
.
_queued_statements
)
except
DatabaseError
as
e
:
if
self
.
_has_executed_statements
or
not
self
.
_connection
.
is_disconnected
(
force_ping
=
True
):
self
.
_
on_error_close_transaction
()
self
.
on_error_close_transaction
()
raise
e
if
not
self
.
_connection
.
try_reconnect
():
self
.
_
on_error_close_transaction
()
self
.
on_error_close_transaction
()
raise
e
try
:
results
=
self
.
_connection
.
execute_statements
(
self
.
_queued_statements
)
except
Exception
as
e
:
self
.
_
on_error_close_transaction
()
self
.
on_error_close_transaction
()
raise
e
except
Exception
as
e
:
self
.
_
on_error_close_transaction
()
self
.
on_error_close_transaction
()
raise
e
self
.
_has_executed_statements
=
True
...
...
@@ -578,7 +578,7 @@ class DbConnectionPool:
transaction
.
close
()
except
Exception
:
if
transaction
is
not
None
and
not
transaction
.
is_closed
():
transaction
.
close
()
transaction
.
on_error_close_transaction
()
raise
@contextmanager
...
...
@@ -602,5 +602,5 @@ class DbConnectionPool:
transaction
.
rollback
()
except
Exception
:
if
transaction
is
not
None
and
not
transaction
.
is_closed
():
transaction
.
rollback
()
transaction
.
on_error_close_transaction
()
raise
This diff is collapsed.
Click to expand it.
src/api/objects/object.py
+
2
−
1
View file @
dec99876
...
...
@@ -418,7 +418,8 @@ class ObjectClass:
if
object_variant
not
in
self
.
_variants_dict
:
raise
ApiClientException
(
ERROR_OBJECT_ERROR
(
f
"
Unknown variant
{
truncate_string
(
object_variant
)
}
"
))
try
:
object_variant_db
=
self
.
_variant_id_type
.
json_value_to_db
(
transaction
,
None
,
object_variant_json
)
object_variant_db
=
self
.
_variant_id_type
.
validate_and_convert_json_value
(
transaction
,
None
,
object_variant_json
)
except
Exception
as
e
:
raise
RuntimeError
(
f
"
Variant
{
truncate_string
(
object_variant
)
}
is declared as possible variant but
"
f
"
variant type does not accept it
"
)
from
e
...
...
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