Add explicit ForbiddenException to IoT HTTP API Response #4870
Labels
feature-request
A feature should be added or improved.
p2
This is a standard priority issue
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
service-api
This issue is due to a problem in a service API, not the SDK implementation.
Describe the feature
Currently, AWS SDK does not throw a Forbidden Exception when a 403 is returned from IoT HTTP calls, but rather, a generic AWSIotDataException is returned with the status code of 403.
The behavior could be better to inform the customer exact exception like there is for the other non-success codes. For instance, in https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iotdata/AWSIotDataClient.java, there are a number of exceptions that can be thrown (for instance, ServiceUnavailableException) -- all of these derive from:
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/iotdata/model/AWSIotDataException.html
And none of them are ForbiddenException.
Use Case
To have a more accurate and obvious exception thrown for forbidden cases.
Proposed Solution
Throw a forbidden exception (maybe ForbiddenException), not a generic AWSIotDataException when HTTP paths return a 403.
Other Information
The breaking change detailed below is if the ForbiddenException isn't derived from AWSIotDataException -- might break devices which has specific logic around AWSIotDataException. If ForbiddenException is derived from AWSIotDataException, this shouldn't be an issue.
Acknowledgements
AWS Java SDK version used
Latest has this code
JDK version used
N/A
Operating System and version
N/A
The text was updated successfully, but these errors were encountered: