Error Handling
SDK exception handling strategy can be configured via the SDK configuration (via configuration file or via ConfigurationBuilder).
By default, any exception thrown during the execution of a publicly available method is thrown by the SDK. When the config option is set to Catch
, exceptions are caught by the SDK and null reference returned to the user. For more information see the ExceptionHandlingStrategy enum.
The exception to this rule is methods on the feed object which are called before the feed is opened - most notably the open method in Java and Open in .Net. Those two methods always throw an exception if the connection to the feed cannot be established.
Exception resulting from method argument validation will always be thrown, disregarding the configured ExceptionHandlingStrategy.
When Returning a list of objects
Another convention used in the SDK is when returning a list of objects.
If the ExceptionHandlingStrategy is set to
Catch
when the exception happens, it will return null
if the ExceptionHandlingStrategy is set to
Throw
when the exception happens, it will throw an exception
Example scenarios when method returns list of objects
asking Schedule for tournament which does not have schedule and
ExceptionHandlingStrategy is set to Catch it will return empty list.
ExceptionHandlingStrategy is set to Catch and during request exception happens. It will return null.
ExceptionHandlingStrategy is set to Throw it will return empty list.
ExceptionHandlingStrategy is set to Throw and during request exception happens. It will throw.
Last updated
Was this helpful?