/// <summary> /// Process endpoint request and retrieve a Rest Response properly /// </summary> /// <param name="path">Request path</param> /// <param name="method">HTTP method</param> /// <param name="request">Rest Request</param> /// <returns>Rest Response</returns> public RestResponse Process(string path, string method, RestRequest request) { try { return(_restProcessor.Process(path, method, request)); } catch (Exception ex) { var exceptionName = ex.InnerException switch { Exception iex => iex.GetType().Name, null => ex.GetType().Name }; IRestExceptionHandler handler = _restProcessor.GetExceptionHandler(exceptionName); if (handler != null) { return(handler.HandleException(ex.InnerException)); } Logger.Error(ex.Message); return(new RestResponse( "Internal Server Error", "plain/text", System.Net.HttpStatusCode.InternalServerError )); } }
/// <summary> /// Process endpoint request and retrieve a Rest Response properly /// </summary> /// <param name="path">Request path</param> /// <param name="method">HTTP method</param> /// <param name="request">Rest Request</param> /// <returns>Rest Response</returns> public RestResponse Process(string path, string method, RestRequest request) { try { return(_restProcessor.Process(path, method, request)); } catch (Exception ex) { var exceptionName = ex.InnerException.GetType().Name; IRestExceptionHandler handler = _restProcessor.GetExceptionHandler(exceptionName); if (handler != null) { return(handler.HandleException(ex.InnerException)); } throw ex; } }