Added ability for throwing http errors