Support custom stacktrace middleware

Adds new option `:stacktrace-middleware`, a middleware function that handles exceptions.

See #20