|
|
|
|
|
by pacala
2552 days ago
|
|
The example was a worst case example. There are weaker versions thereof, for example the familiar: def handle(request):
try:
return Response(200, process(request))
except UserError as ex:
return Response(400, ex.message)
except InternalError as ex:
return Response(500)
The principle stays the same, there is not much to "handle" and no option to recover without external help, either by providing a well-formed request for 400 errors or by providing well-behaving code for 500 errors. |
|
There are legitimate criticisms to be made of how Go's error handling works, but I think the language already handles the case you're talking about.