-
Notifications
You must be signed in to change notification settings - Fork 36
Exception Handling
The exception handling is slightly different between the synchronous and asynchronous methods.
The actual exceptions thrown (directly or inside AggregateException
) always inherits from EveLibException
. If any other exception is thrown, that is a bug and should be reported. Most exceptions will inherit from EveLibWebException
, which indicates there was an error when performing the web request. All EveLibWebExceptions have a property WebException
, which contains the responsible WebException
. Most modules throw EveLibWebException
directly, unless otherwise is stated. (Currently EveXml
and EveCrest
throw more specific exceptions).
Because the synchronous methods use sync over async, they can throw multiple exceptions. This is handled by wrapping all exceptions in an AggregateException
, which has a list, InnerExceptions
, of all Exceptions that has been thrown. When using the synchronous methods, you need to catch AggregateException
, and then check the inner exceptions.
When using async/await, the AggregateException
is unwrapped and only the first inner exception is thrown. The AggregateException
is available through the Exception property on the Task that is awaited. Catch InvalidRequestException
or any other specific exception, like normal, and check the Exception
on the Task if you need to handle more than the first. For examples of handling AggregateException, see http://msdn.microsoft.com/en-us/library/dd537614(v=vs.110).aspx