I've written an ExceptionInterceptor
that wraps the operation invocation in a try
/catch
to have centralized exception handling. What I also want to do is have centralized HTTP status code handling, but I seem to be unable to set the HTTP status code from within my IOperationInterceptor
. My Interceptor takes ICommunicationContext
as a dependency and sets its OperationResult
to e.g. OperationResult.BadRequest
, but OpenRasta still writes the following to the log:
Step into: Stepping over non-user code 'OpenRasta.Pipeline.PipelineRunner.RunCallGraph'
38-[2011-07-08 09:11:37Z] Start(1) Entering PipelineRunner: Executing contributor OperationResultInvokerContributor.RunOperationResult
38-[2011-07-08 09:11:37Z] Information(0) Executing OperationResult OperationResult: type=OK, statusCode=200.
I've also tried setting the IResponse.StatusCode
explicitly, but it has no effect. It seems that because the ResponseResource I want to respond with is a valid resource registered in ResourceSpace
(though without a URI), the status code is ignored and the regular rendering pipeline thrusts forward thinking "this looks okay".
Why is OpenRasta ignoring my StatusCode?