0

I want to handle application's internal exceptions in a consistent way so that REST web services return errors in a RESTful way.

I'm using Castle's WCF integration and I couldn't find any good sources on how to do handle errors using WcfIntegration.WindsorServiceHostFactory. The only solution that comes to mind is to use Castle's interceptors on web service methods to catch "internal" exceptions and translate them to HTTP response properties (for example: KeyNotFoundException would be translated to 404 Not Found status code).

Are there any better ways? Thanks.

Community
  • 1
  • 1
Igor Brejc
  • 18,714
  • 13
  • 76
  • 95

2 Answers2

1

What about standard WCF IErrorHandler ?

Krzysztof Kozmic
  • 27,267
  • 12
  • 73
  • 115
0

Check out my answer to this question. I think the reason for the HttpContext.Current being null may be related.

Community
  • 1
  • 1
Darrel Miller
  • 139,164
  • 32
  • 194
  • 243