Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/better errors #283

Merged
merged 5 commits into from
Jan 19, 2023
Merged

Feature/better errors #283

merged 5 commits into from
Jan 19, 2023

Conversation

danfunk
Copy link
Collaborator

@danfunk danfunk commented Jan 16, 2023

  • Added a top level SpiffWorklowException that all exceptions inherit from.
  • All SpiffWorlfowExceptions have an add_note() function. This is a standard method for all exceptions starting in python 3.11. We'll introduce it now for all of our exceptions. In this way, as an error is raised, we can catch it, and append notes for added context. It is currently used in several places, such as to add "Did you mean...." when creating WorkflowTaskExecptions, or to tell people the error occurred in a PreScript, or say what row of a DMN Table the error happened in.
  • Switched argument order in WorkflowException, WorkflowTaskException - they now always takes a string message as the first argument, and named arguments thereafter, making them more consistent with all other error messages in Python.
  • Consistently raise ValidationExceptions whenever we encounter an error anywhere during parsing of xml.
  • Removed The BPMN/WorkflowTaskExecException, replaced with a standard WorkflowTaskException. There is nothing BPMN Specific in the logic anymore, so it just siplified out.
  • Consolidated error message logic as high up the error class hierarchy as possible. So that things like "Did you mean" just get added by default whenever possible.
  • Better Error messages for DMN (include row number as a part of the error information)
  • Validators now catch more general exceptions from lxml

…rom. Aside from a message string you can append information to these exceptions with "add_note", which is a new method that all exceptions have starting in python 3.11

Switched arguments to the WorkflowException, WorkflowTaskException - which now always takes a string message as the first argument, and named arguments thereafter to be consistent with all other error messages in Python.
Consistently raise ValidationExceptions whenever we encounter an error anywhere during parsing of xml.
The BPMN/WorkflowTaskExecException is removed, in favor of just calling a WorkflowTaskException.  There is nothing BPMN Specific in the logic, so no need for this.
Consolidated error message logic so that things like "Did you mean" just get added by default if possible.  So we don't have to separately deal with that logic each time.
Better Error messages for DMN (include row number as a part of the error information)

Validators now catch more general exceptions from lxml
When catching errors, check to see if they are SpiffWorkflow errors already, and if so, just add a note to help provide additional context for the error.
@jbirddog
Copy link
Contributor

Just wanted to double check you meant for graphics/spiffworkflow_logo_ideas.svg to be included.

doc/errors.rst Outdated Show resolved Hide resolved
1) Avoid deserialization errors by setting a default to the row_number for DMN
2) Since we are updating signatures on error messages, have the WorkflowException take a "task_spec" rather than the obscure "sender"
…re isn't filename for validation errors, and file_name for WorkflowExceptions. Same for line_number vs sourceline.

* Assure than an error_type is consistently set on exceptions.
* ValidationExceptions should not bild up a detailed error message that replicates information available within it.
@sonarcloud
Copy link

sonarcloud bot commented Jan 18, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

68.5% 68.5% Coverage
0.0% 0.0% Duplication

@danfunk danfunk merged commit 1f51db9 into main Jan 19, 2023
@danfunk danfunk deleted the feature/better_errors branch January 19, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants