move some exception handling to a better place

HTTPExceptions should be handled in the outmost callable
that way it's easier to catch all the exceptions that may arise anywhere in objectquery code
strategically moved all the debug logging and exception handling into `__call__` method of the middleware