private HttpResponseMessage HandleInvalidVersionEx(InvalidVersionFormatException ex)
 {
     var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
     {
         ReasonPhrase = "version_bad_format"
     };
     return resp;
 }
Пример #2
0
        private HttpResponseMessage HandleInvalidVersionEx(InvalidVersionFormatException ex)
        {
            var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                ReasonPhrase = "version_bad_format"
            };

            return(resp);
        }
Пример #3
0
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            Exception ex = actionExecutedContext.Exception;

            BucketNotFoundException bEx = ex as BucketNotFoundException;

            if (bEx != null)
            {
                actionExecutedContext.Response = HandleBucketNotFoundEx(bEx);
                return;
            }
            DocumentNotFoundException dEx = ex as DocumentNotFoundException;

            if (dEx != null)
            {
                actionExecutedContext.Response = HandleDocNotFoundEx(dEx);
                return;
            }
            InvalidVersionFormatException ivEx = ex as InvalidVersionFormatException;

            if (ivEx != null)
            {
                actionExecutedContext.Response = HandleInvalidVersionEx(ivEx);
                return;
            }
            ConflictException cfEx = ex as ConflictException;

            if (cfEx != null)
            {
                actionExecutedContext.Response = HandleConflictEx(cfEx);
                return;
            }

            actionExecutedContext.Response = new HttpResponseMessage(HttpStatusCode.InternalServerError)
            {
                Content      = new StringContent("An error occurred, please try again or contact the administrator."),
                ReasonPhrase = "internal_error"
            };
        }