Replace exceptions with HTTP headers