Merge remote-tracking branch 'origin/main' into feature/ui_tweaks

This commit is contained in:
Dan 2023-02-03 14:34:17 -05:00
commit 324aec2abe
4 changed files with 14 additions and 22 deletions

11
poetry.lock generated
View File

@ -2848,18 +2848,7 @@ psycopg2 = [
{file = "psycopg2-2.9.5.tar.gz", hash = "sha256:a5246d2e683a972e2187a8714b5c2cf8156c064629f9a9b1a873c1730d9e245a"}, {file = "psycopg2-2.9.5.tar.gz", hash = "sha256:a5246d2e683a972e2187a8714b5c2cf8156c064629f9a9b1a873c1730d9e245a"},
] ]
pyasn1 = [ pyasn1 = [
{file = "pyasn1-0.4.8-py2.4.egg", hash = "sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3"},
{file = "pyasn1-0.4.8-py2.5.egg", hash = "sha256:0458773cfe65b153891ac249bcf1b5f8f320b7c2ce462151f8fa74de8934becf"},
{file = "pyasn1-0.4.8-py2.6.egg", hash = "sha256:5c9414dcfede6e441f7e8f81b43b34e834731003427e5b09e4e00e3172a10f00"},
{file = "pyasn1-0.4.8-py2.7.egg", hash = "sha256:6e7545f1a61025a4e58bb336952c5061697da694db1cae97b116e9c46abcf7c8"},
{file = "pyasn1-0.4.8-py2.py3-none-any.whl", hash = "sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d"}, {file = "pyasn1-0.4.8-py2.py3-none-any.whl", hash = "sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d"},
{file = "pyasn1-0.4.8-py3.1.egg", hash = "sha256:78fa6da68ed2727915c4767bb386ab32cdba863caa7dbe473eaae45f9959da86"},
{file = "pyasn1-0.4.8-py3.2.egg", hash = "sha256:08c3c53b75eaa48d71cf8c710312316392ed40899cb34710d092e96745a358b7"},
{file = "pyasn1-0.4.8-py3.3.egg", hash = "sha256:03840c999ba71680a131cfaee6fab142e1ed9bbd9c693e285cc6aca0d555e576"},
{file = "pyasn1-0.4.8-py3.4.egg", hash = "sha256:7ab8a544af125fb704feadb008c99a88805126fb525280b2270bb25cc1d78a12"},
{file = "pyasn1-0.4.8-py3.5.egg", hash = "sha256:e89bf84b5437b532b0803ba5c9a5e054d21fec423a89952a74f87fa2c9b7bce2"},
{file = "pyasn1-0.4.8-py3.6.egg", hash = "sha256:014c0e9976956a08139dc0712ae195324a75e142284d5f87f1a87ee1b068a359"},
{file = "pyasn1-0.4.8-py3.7.egg", hash = "sha256:99fcc3c8d804d1bc6d9a099921e39d827026409a58f2a720dcdb89374ea0c776"},
{file = "pyasn1-0.4.8.tar.gz", hash = "sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba"}, {file = "pyasn1-0.4.8.tar.gz", hash = "sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba"},
] ]
pycodestyle = [ pycodestyle = [

View File

@ -3554,4 +3554,4 @@
"clientPolicies" : { "clientPolicies" : {
"policies" : [ ] "policies" : [ ]
} }
} }

View File

@ -15,7 +15,8 @@ from flask import jsonify
from flask import make_response from flask import make_response
from sentry_sdk import capture_exception from sentry_sdk import capture_exception
from sentry_sdk import set_tag from sentry_sdk import set_tag
from SpiffWorkflow.exceptions import WorkflowException # type: ignore from SpiffWorkflow.exceptions import SpiffWorkflowException # type: ignore
from SpiffWorkflow.exceptions import WorkflowException
from SpiffWorkflow.exceptions import WorkflowTaskException from SpiffWorkflow.exceptions import WorkflowTaskException
from SpiffWorkflow.specs.base import TaskSpec # type: ignore from SpiffWorkflow.specs.base import TaskSpec # type: ignore
from SpiffWorkflow.task import Task # type: ignore from SpiffWorkflow.task import Task # type: ignore
@ -136,7 +137,7 @@ class ApiError(Exception):
cls, cls,
error_code: str, error_code: str,
message: str, message: str,
exp: WorkflowException, exp: SpiffWorkflowException,
) -> ApiError: ) -> ApiError:
"""Deals with workflow exceptions. """Deals with workflow exceptions.
@ -145,6 +146,7 @@ class ApiError(Exception):
we can with the data we have. we can with the data we have.
""" """
if isinstance(exp, WorkflowTaskException): if isinstance(exp, WorkflowTaskException):
# Note that WorkflowDataExceptions are also WorkflowTaskExceptions
return ApiError.from_task( return ApiError.from_task(
error_code, error_code,
message, message,
@ -155,9 +157,10 @@ class ApiError(Exception):
error_line=exp.error_line, error_line=exp.error_line,
task_trace=exp.task_trace, task_trace=exp.task_trace,
) )
elif isinstance(exp, WorkflowException):
else:
return ApiError.from_task_spec(error_code, message, exp.task_spec) return ApiError.from_task_spec(error_code, message, exp.task_spec)
else:
return ApiError("workflow_error", str(exp))
def set_user_sentry_context() -> None: def set_user_sentry_context() -> None:

View File

@ -42,7 +42,8 @@ from SpiffWorkflow.bpmn.specs.SubWorkflowTask import SubWorkflowTask # type: ig
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow # type: ignore from SpiffWorkflow.bpmn.workflow import BpmnWorkflow # type: ignore
from SpiffWorkflow.dmn.parser.BpmnDmnParser import BpmnDmnParser # type: ignore from SpiffWorkflow.dmn.parser.BpmnDmnParser import BpmnDmnParser # type: ignore
from SpiffWorkflow.dmn.serializer.task_spec import BusinessRuleTaskConverter # type: ignore from SpiffWorkflow.dmn.serializer.task_spec import BusinessRuleTaskConverter # type: ignore
from SpiffWorkflow.exceptions import WorkflowException # type: ignore from SpiffWorkflow.exceptions import SpiffWorkflowException # type: ignore
from SpiffWorkflow.exceptions import WorkflowException
from SpiffWorkflow.exceptions import WorkflowTaskException from SpiffWorkflow.exceptions import WorkflowTaskException
from SpiffWorkflow.serializer.exceptions import MissingSpecError # type: ignore from SpiffWorkflow.serializer.exceptions import MissingSpecError # type: ignore
from SpiffWorkflow.spiff.serializer.config import SPIFF_SPEC_CONFIG # type: ignore from SpiffWorkflow.spiff.serializer.config import SPIFF_SPEC_CONFIG # type: ignore
@ -603,7 +604,7 @@ class ProcessInstanceProcessor:
) )
) )
except Exception as err: except Exception as err:
raise (err) raise err
finally: finally:
spiff_logger.setLevel(original_spiff_logger_log_level) spiff_logger.setLevel(original_spiff_logger_log_level)
@ -632,7 +633,7 @@ class ProcessInstanceProcessor:
) -> None: ) -> None:
"""Raise_if_no_potential_owners.""" """Raise_if_no_potential_owners."""
if not potential_owner_ids: if not potential_owner_ids:
raise (NoPotentialOwnersForTaskError(message)) raise NoPotentialOwnersForTaskError(message)
def get_potential_owner_ids_from_task( def get_potential_owner_ids_from_task(
self, task: SpiffTask self, task: SpiffTask
@ -1516,9 +1517,8 @@ class ProcessInstanceProcessor:
if hasattr(handler, "bulk_insert_logs"): if hasattr(handler, "bulk_insert_logs"):
handler.bulk_insert_logs() # type: ignore handler.bulk_insert_logs() # type: ignore
db.session.commit() db.session.commit()
except SpiffWorkflowException as swe:
except WorkflowTaskException as we: raise ApiError.from_workflow_exception("task_error", str(swe), swe) from swe
raise ApiError.from_workflow_exception("task_error", str(we), we) from we
finally: finally:
if save: if save: