added custom error type, handling of 404 and 500 HTTP errors