handle exception from underlying container properly

handle uncaught exceptions by returning a 500 status code and close the channel if appropriate