Skip to content

Commit 64fcbfc

Browse files
committed
Improve worker error handler in tests and readme
1 parent acd2b4a commit 64fcbfc

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
Python SDK for [iWF workflow engine](https://github.com/indeedeng/iwf)
55

66
```
7-
pip install iwf-python-sdk==0.1.0
7+
pip install iwf-python-sdk==0.1.2
88
```
99

10-
See [samples](https://github.com/indeedeng/iwf-python-samples) for examples.
10+
See [samples](https://github.com/indeedeng/iwf-python-samples) for use case examples.
1111

1212
## Requirements
1313

1414
- Python 3.9+
15-
- [iWF server](https://github.com/indeedeng/iwf#using-docker-image--docker-compose)
15+
- [iWF server](https://github.com/indeedeng/iwf#how-to-use)
1616

1717
## Concepts
1818

iwf/tests/worker_server.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,11 @@ def handle_rpc():
4848
return resp.to_dict()
4949

5050

51+
# this handler is extremely useful for debugging iWF
52+
# the WebUI will be able to show you the error with stacktrace
5153
@_flask_app.errorhandler(Exception)
5254
def internal_error(exception):
53-
# TODO: how to print to std ??
54-
response = exception.get_response()
55-
# replace the body with JSON
56-
response.data = traceback.format_exc()
57-
response.content_type = "application/json"
58-
response.status_code = 500
59-
return response
55+
return traceback.format_exc(), 500
6056

6157

6258
_webApp = Thread(target=_flask_app.run, args=("0.0.0.0", 8802))

0 commit comments

Comments
 (0)