provide a task-based get_ident

this solves "Popped wrong request context" problems, as the requests are
always handled in the context of their respective task.
try to handle exceptions that occur in asynchronous execution

this can't handle all cases (when the task has already started sending
a response, the server can't roll back and present a 500), but when the
response is not sent yet, now a response is sent.