threefoldtecharchive / jumpscaleX_core

Apache License 2.0
1 stars 6 forks source link

raising a j.exceptions.NotFound gives a 400 Bad Request and a stacktrace [unstable] #663

Closed robvanmieghem closed 4 years ago

robvanmieghem commented 4 years ago

When raising a j.exception,NotFound exception in an actor, a 400 Bad Request status is returned together with a stacktrace. One would expect a 404 (Not Found) and no stacktrace


< HTTP/1.1 400 Bad Request
< Server: openresty/1.13.6.2
< Date: Tue, 24 Mar 2020 20:16:43 GMT
< Content-Type: application/json
< Content-Length: 1051
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE
< Access-Control-Allow-Headers: Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token
<
* Connection #0 to host localhost left intact
{"error": "Traceback (most recent call last):\n  File \"/sandbox/code/github/threefoldfoundation/tft-stellar/ThreeBotPackages/unlock-service/actors/unlock_service.py\", line 45, in get_unlockhash_transaction\n    raise j.exceptions.NotFound()\nJumpscale.core.InstallTools.JSExceptions.__init__.<locals>.NotFound1: None\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/sandbox/lib/jumpscale/threebot_packages/zerobot/webinterface/bottle/gedis.py\", line 72, in gedis_http\n    result = command(**data[\"args\"])\n  File \"/sandbox/lib/jumpscale/Jumpscale/core/BASECLASSES/Decorators.py\", line 65, in wrapper_action\n    res = func(self, **kwargs)\n  File \"/sandbox/code/github/threefoldfoundation/tft-stellar/ThreeBotPackages/unlock-service/actors/unlock_service.py\", line 48, in get_unlockhash_transaction\n    raise j.exceptions.NotFound(\"unlocktransaction with hash %s not found\" % unlockhash)\nJumpscale.core.InstallTools.JSExceptions.__init__.<locals>.NotFound1: None\n"}* Closing connection 0
``
alichaddad commented 4 years ago

See https://github.com/threefoldtech/jumpscaleX_threebot/commit/0e0324caa476bfa8d87cf764913c89f1005eb3ac