Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exception handling
Message
 
 
To
25/05/2017 12:12:22
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
C#
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01651425
Message ID:
01651494
Views:
48
>>>Why not just test for the presence of the innerexception != null and if it isn't set the errormessage to that text.
>>>
>>>
>>>   var msg = "";
>>>   if(string.IsNotNull(ex.InnerException))
>>>   {
>>>        msg = ex.InnerException;
>>>        throw new DuplicatePropertyException(msg);
>>>   }
>>>
>>>
>>
>>This is not what I am asking. I am asking specifically about
>>
>>throw ex
>>
>>part.
>>
>>In the throw ex is there a way to append that inner exception? E.g. what should I throw?
>
>You care a new message like I showed you and throw a new exception with that message. You can't append to ex.

I see, thanks. So, it would be throw new Exception(message).

I'll think if I want to do it or not.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform