I'm new to ASP.NET and MVC. In my controller I'm throwing ArgumentException
on invalid user input. I like the fact that the client is getting some info back in JSON format. But I don't want to send the whole stacktrace, just the exception message (which contains a useful, localized explanation of the error).
How should I go about doing this?
I've seen some Application_Error()
and FilterException
, but they all seem to be redirecting to a special "error" view, whilst I want to stay on the same page and just print out a dialog with the user-friendly explanation.