Skip to content

Commit

Permalink
Merge pull request #820 from neuroglia-io/main
Browse files Browse the repository at this point in the history
Refactor error handling
  • Loading branch information
cdavernas authored May 17, 2024
2 parents ca10bc3 + 0073684 commit 6e2d402
Show file tree
Hide file tree
Showing 8 changed files with 1,161 additions and 528 deletions.
50 changes: 26 additions & 24 deletions examples/new-patient-onboarding.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,21 @@
{
"name": "store-patient",
"functionRef": "store-patient",
"retryRef": "services-not-available-retry-strategy",
"retryableErrors": [
"service-not-available"
]
"onErrors": "fault-tolerance"
},
{
"name": "assign-doctor",
"functionRef": "assign-doctor",
"retryRef": "services-not-available-retry-strategy",
"retryableErrors": [
"service-not-available"
]
"onErrors": "fault-tolerance"
},
{
"name": "schedule-appt",
"functionRef": "schedule-appt",
"retryRef": "services-not-available-retry-strategy",
"retryableErrors": [
"service-not-available"
]
"onErrors": "fault-tolerance"
}
]
}
],
"onErrors": [
{
"errorRef": "service-not-available",
"end": true
}
],
"end": true
}
],
Expand All @@ -70,12 +55,29 @@
"operation": "api/services.json#scheduleAppointment"
}
],
"errors": [
{
"name": "service-not-available",
"code": "503"
}
],
"errors": {
"handlers":[
{
"name": "handle-503-errors",
"when":[
{
"status": 503
}
],
"retry": "services-not-available-retry-strategy"
}
],
"policies":[
{
"name": "fault-tolerance",
"handlers":[
{
"refName": "handle-503-errors"
}
]
}
]
},
"retries": [
{
"name": "services-not-available-retry-strategy",
Expand Down
1 change: 0 additions & 1 deletion examples/process-transactions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "Customer Banking Transactions Workflow",
"version": "1.0.0",
"specVersion": "0.8",
"autoRetries": true,
"constants": {
"largetxamount": 5000
},
Expand Down
41 changes: 24 additions & 17 deletions examples/provision-orders.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@
"operation": "http://myapis.org/provisioningapi.json#doProvision"
}
],
"errors": [
{
"name": "missing-order-id"
},
{
"name": "missing-order-item"
},
{
"name": "missing-order-quantity"
}
],
"states": [
{
"name": "provision-order",
Expand All @@ -43,16 +32,34 @@
"transition": "apply-order",
"onErrors": [
{
"errorRef": "missing-order-id",
"transition": "missing-id"
"when": [
{
"type": "/samples/errors/missing-order-id"
}
],
"then": {
"transition": "missing-id"
}
},
{
"errorRef": "missing-order-item",
"transition": "missing-item"
"when": [
{
"type": "/samples/errors/missing-order-item"
}
],
"then": {
"transition": "missing-item"
}
},
{
"errorRef": "missing-order-quantity",
"transition": "missing-quantity"
"when": [
{
"type": "/samples/errors/missing-order-quantity"
}
],
"then": {
"transition": "missing-quantity"
}
}
]
},
Expand Down
7 changes: 6 additions & 1 deletion package-lock.json

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

1 change: 1 addition & 0 deletions roadmap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ _Status description:_
| ✔️| Add the new `WORKFLOW` reserved keyword to workflow expressions |
| ✔️| Update `ForEach` state iteration parameter example. This parameter is an expression variable, not a JSON property |
| ✔️| Add the new `rest` function type [spec doc](https://github.com/serverlessworkflow/specification/tree/main/specification.md#using-functions-for-restful-service-invocations) |
| ✔️| Refactor error handling and retries |
| ✏️️| Add inline state defs in branches | |
| ✏️️| Add "completedBy" functionality | |
| ✏️️| Define workflow context | |
Expand Down
Loading

0 comments on commit 6e2d402

Please sign in to comment.