Regarding the duplicated. I can access the
Messageproperty but not theDetailproperty even when I can see is part of the Exception object during debuging. So the question is Why cant accessDetailproperty.
I catch an exception.
catch (Exception ex)
{
string msg = ex.InnerException.InnerException.Message;
// say Exception doesnt have Detail property
// string detail = ex.InnerException.InnerException.Detail;
return Json(new { status = "Fail", message = msg, detail: detail });
}
ex.InnerException show same message

ex.InnerException.InnerException. finally some real message, "db table duplicated key"

ex.InnerException.InnerException.Message I can get the message.

But cant get the Detail "the guilty key" even when there is one property Detail
- So how can I get the Detail?.
- Bonus: Why have to go deep
InnerExceptiontwice to get some meaningfull message?

