Made a helper function to throw HttpStatusExceptions