Exception Handling
There are four types of exceptions throwing from the API client library. And all the exceptions extended to SigfoxException class. So you can catch all the exceptions that throwing from this client library by this exception class.
- Serialization & Deserialization Exceptions
These exceptions throwing when you or the Sigfox server pass a different typed value than the expected value.
DeserializationException is throwing when a user input array or a server returned response converting to objects.
SerializeExceptions is throwing when a object converting to an array. You can get the expected type name as a
string by
getExpectedType
method and actual type name by thegetActualType
method. SerializeException API Reference DeserializeException API Reference - Validation Exceptions
There are some validations for parameters in the sigfox API documentation. Validation Exceptions throwing if you
provide an invalid value according to these validation rules. You can get the invalid value by
getValue
method and validation rule bygetRule
method. ValidationException API Reference - Response Exceptions These exceptions throwing when the server returned an HTTP error code. You can catch all HTTP errors by ResponseException class. Use below exceptions if you want to catch only specific error codes.
- BadRequestException :- You can get the list of errors that received from the Sigfox using the `getErrors` method.
- ConflictException
- ForbiddenException
- InternalServerException
- MethodNotAllowedException :- You can get a list of allowed methods using the `getAllowedMethods` method.
- NotFoundException
- PreconditionFailedException
- UnauthorizedException You can get the HTTP error code of every ResponseException s by `getCode` method.
- Unexpected Response Exception
When the server returned an error code that not mentioned in the documentation. But you can not catch it using
the ResponseException .
Next:- File Downloads