0

One of our production customers just had a problem uploading a file to S3. When the error was printed out to the log, we received a undescriptive error message:

com.amazonaws.services.s3.model.AmazonS3Exception: BadRequest(Service: AmazonS3;StatusCode: 400;ErrorCode:400BadRequest;RequestID: XXXXXXXXXXXXXXXX) 

400 Bad Request maps to a large number of errors:

http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html

It is impossible to debug on this error alone. My question is, how can I get an Error Code (as listed in the html page above) from the Java SDK when an error happens? Is there a generic way getting descriptive Error Code not just for S3, but for all AWS Java SDK Errors?

Robert Allurent
  • 187
  • 1
  • 2
  • 10

1 Answers1

0

You should be able to get access to the full XML response that S3 sends back to the Java SDK using getErrorResponseXml on AmazonS3Exception.

kiiadi
  • 381
  • 2
  • 7