global http error handler for api/*