예제 #1
0
        /// <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));
        }
예제 #2
0
        /// <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));
        }
예제 #3
0
        /// <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));
        }
예제 #4
0
        /// <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));
        }