/// <summary> /// Throws a HTTP 409 error /// </summary> public static Exception Conflict(string message = null) { string formattedMessage = (message.HasValue() ? message : HttpErrorCode.FromHttpStatusCode(HttpStatusCode.Conflict)); return(new HttpError(HttpStatusCode.Conflict, HttpErrorCode.FromHttpStatusCode(HttpStatusCode.Conflict), formattedMessage)); }
/// <summary> /// Throws a HTTP 403 forbidden /// </summary> public static Exception Forbidden(string message = null) { string formattedMessage = (message.HasValue() ? message : HttpErrorCode.FromHttpStatusCode(HttpStatusCode.Forbidden)); return(new HttpError(HttpStatusCode.Forbidden, HttpErrorCode.FromHttpStatusCode(HttpStatusCode.Forbidden), formattedMessage)); }
/// <summary> /// Throws a HTTP 404 error /// </summary> public static Exception NotFound(string message = null) { string formattedMessage = (message.HasValue() ? message : HttpErrorCode.FromHttpStatusCode(HttpStatusCode.NotFound)); return(new HttpError(HttpStatusCode.NotFound, HttpErrorCode.FromHttpStatusCode(HttpStatusCode.NotFound), formattedMessage)); }
/// <summary> /// Throws a HTTP 500 internal server error /// </summary> public static Exception InternalServerError(string message = null) { string formattedMessage = (message.HasValue() ? message : HttpErrorCode.FromHttpStatusCode(HttpStatusCode.InternalServerError)); return(new HttpError(HttpStatusCode.InternalServerError, HttpErrorCode.FromHttpStatusCode(HttpStatusCode.InternalServerError), formattedMessage)); }