Safe2COVIDApp / bct-server

Bluetooth Contact Tracing for Covid19 - server
5 stars 1 forks source link

Error handling in twisted #72

Closed mitra42 closed 4 years ago

mitra42 commented 4 years ago

Its unclear how to do do this a: change line server.py Simple.render line 98 to pass the request to every function b: somehow know in the return from each function that its an error, c: have the function throw an exception and wrap line 98 to catch that. (In Javascript I throw an Error Class with a status and message field, but I’m not sure what the pythonic/twisted way to do this is

For now, I'm assuming that a string return is an error - detecting that in Simple.render line 98 and then doing the request.setResponseCode(302) thing that Dan suggested.

This seems the WRONG way to do it, so I've flagged everywhere I've done this with TODO-72 and can quickly change it to any of a,b or c once I get clarity (from Dan).

mitra42 commented 4 years ago

Oops - duplicate