If we have an action with the following code:
Exception exception = new Exception("0");
for (int count = 0; count < 10; count++)
{
exception = new Exception(count.ToString(), exception);
}
throw exception;
then only the inner exception (with message “0”) will get reported to the client:
{"Message":"An error has occurred.","ExceptionMessage":"0","ExceptionType":"System.Exception","StackTrace":null}
The reason is that we use Exception.GetBaseException() which automatically unwraps to the absolute inner exception.
A better model would be to an exception-unwrap implementation that only unwraps certain specific exceptions such as AggregateException and TargetInvocationException.
Henrik
Exception exception = new Exception("0");
for (int count = 0; count < 10; count++)
{
exception = new Exception(count.ToString(), exception);
}
throw exception;
then only the inner exception (with message “0”) will get reported to the client:
{"Message":"An error has occurred.","ExceptionMessage":"0","ExceptionType":"System.Exception","StackTrace":null}
The reason is that we use Exception.GetBaseException() which automatically unwraps to the absolute inner exception.
A better model would be to an exception-unwrap implementation that only unwraps certain specific exceptions such as AggregateException and TargetInvocationException.
Henrik