Skip to content

Commit

Permalink
[ADDED] Exceptions to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanMartens committed Sep 30, 2020
1 parent 49d9941 commit 61ffe49
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ python:
sphinx:
builder: html
configuration: docs/conf.py
#fail_on_warning: true
fail_on_warning: true
Empty file added docs/_static/.gitkeep
Empty file.
39 changes: 39 additions & 0 deletions docs/exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
==========
Exceptions
==========

All ``pyzeebe`` exceptions inherit from :py:class:`PyZeebeException`

.. autoexception:: pyzeebe.exceptions.PyZeebeException

.. autoexception:: pyzeebe.exceptions.TaskNotFound

.. autoexception:: pyzeebe.exceptions.NoVariableNameGiven

.. autoexception:: pyzeebe.exceptions.NoZeebeAdapter

.. autoexception:: pyzeebe.exceptions.DuplicateTaskType

.. autoexception:: pyzeebe.exceptions.ActivateJobsRequestInvalid

.. autoexception:: pyzeebe.exceptions.JobAlreadyDeactivated

.. autoexception:: pyzeebe.exceptions.JobNotFound

.. autoexception:: pyzeebe.exceptions.MessageAlreadyExists

.. autoexception:: pyzeebe.exceptions.WorkflowNotFound

.. autoexception:: pyzeebe.exceptions.WorkflowInstanceNotFound

.. autoexception:: pyzeebe.exceptions.WorkflowHasNoStartEvent

.. autoexception:: pyzeebe.exceptions.WorkflowInvalid

.. autoexception:: pyzeebe.exceptions.InvalidJSON

.. autoexception:: pyzeebe.exceptions.ZeebeBackPressure

.. autoexception:: pyzeebe.exceptions.ZeebeGatewayUnavailable

.. autoexception:: pyzeebe.exceptions.ZeebeInternalError
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ Table Of Contents
Client <client>
Worker <worker>
Decorators <decorators>
Exceptions <exceptions>
27 changes: 27 additions & 0 deletions pyzeebe/job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def __init__(self, key: int, _type: str, workflow_instance_key: int, bpmn_proces
def set_success_status(self) -> None:
"""
Success status means that the job has been completed as intended.
Raises:
NoZeebeAdapter: If the job does not have a configured ZeebeAdapter
ZeebeBackPressure: If Zeebe is currently in back pressure (too many requests)
ZeebeGatewayUnavailable: If the Zeebe gateway is unavailable
ZeebeInternalError: If Zeebe experiences an internal error
"""
if self.zeebe_adapter:
self.zeebe_adapter.complete_job(job_key=self.key, variables=self.variables)
Expand All @@ -38,6 +45,16 @@ def set_failure_status(self, message: str) -> None:
"""
Failure status means a technical error has occurred. If retried the job may succeed.
For example: connection to DB lost
Args:
message (str): The failure message that Zeebe will receive
Raises:
NoZeebeAdapter: If the job does not have a configured ZeebeAdapter
ZeebeBackPressure: If Zeebe is currently in back pressure (too many requests)
ZeebeGatewayUnavailable: If the Zeebe gateway is unavailable
ZeebeInternalError: If Zeebe experiences an internal error
"""
if self.zeebe_adapter:
self.zeebe_adapter.fail_job(job_key=self.key, message=message)
Expand All @@ -48,6 +65,16 @@ def set_error_status(self, message: str) -> None:
"""
Error status means that the job could not be completed because of a business error and won't ever be able to be completed.
For example: a required parameter was not given
Args:
message (str): The error message that Zeebe will receive
Raises:
NoZeebeAdapter: If the job does not have a configured ZeebeAdapter
ZeebeBackPressure: If Zeebe is currently in back pressure (too many requests)
ZeebeGatewayUnavailable: If the Zeebe gateway is unavailable
ZeebeInternalError: If Zeebe experiences an internal error
"""
if self.zeebe_adapter:
self.zeebe_adapter.throw_error(job_key=self.key, message=message)
Expand Down

0 comments on commit 61ffe49

Please sign in to comment.