Skip to content

Commit

Permalink
Changed codebase to use new custom exception classes for better error…
Browse files Browse the repository at this point in the history
… handling and debugging.
  • Loading branch information
xiaoxiaolulu committed Jun 4, 2024
1 parent 893f527 commit 491636c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 48 deletions.
83 changes: 37 additions & 46 deletions backend/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions backend/unitrunner/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
BASE_DIR,
DATABASES
)
from unitrunner import exceptions
from unitrunner.constructor.create_function import create_function_from_parameters
from unitrunner.builitin import compares
from unitrunner.engine.extract import extract_by_object
Expand Down Expand Up @@ -75,7 +76,7 @@ def function_template(*args):
else:
try:
eval(step_key)(step_value)
except (NameError, KeyError, ValueError, AttributeError):
except exceptions.StepRuntimeError:
continue

f = create_function_from_parameters(
Expand Down Expand Up @@ -104,7 +105,7 @@ def execute_sql(self) -> dict[str, Callable[[Any], Any] | Callable[[Any], Any]]
return {
"query_sql": db.execute
}
except Exception as err:
except exceptions.MysqlConnectionException as err:
log.error(f"❌Mysql Not connected {err}")
return none_obj

Expand Down
5 changes: 5 additions & 0 deletions backend/unitrunner/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@ class ExtractException(BaseError):
class GetTimestampException(BaseError):

pass


class StepRuntimeError(BaseError):

pass

0 comments on commit 491636c

Please sign in to comment.