better implementation of HTTP Exception handling