aws-sdk-perl icon indicating copy to clipboard operation
aws-sdk-perl copied to clipboard

another dev question

Open byterock opened this issue 6 years ago • 2 comments

I was playing with this test case

25_error_on_malformed_response.t

and this test

throws_ok(
    sub {
      $s->Method3(response => 'notanxmlstring', status => $status)
    },
    "Paws::Exception",
  );
  cmp_ok($@->code, 'eq', 'InvalidContent', 'Exception of type InvalidContent');

The question is why are we even testing this?? If the response comming back from AWS is status 200 and XML comming back is malformed then that is not Paws fault??

It should not really thow a 'Paws::Exception' it should just die with the data comming back? I guess what I am saying is that we might not not need to test/catch this sort of error that is comming from AWS.

byterock avatar Sep 26 '19 23:09 byterock

Hi,

IIRC we are throwing an exception because at some point in time AWS has returned invalid XML on non-200 responses (the test suite tries to covers more cases). The error message was too cryptic when invalid XML came in, so we started to throw a Paws::Exception that at least gives you an indication of what went on.

pplu avatar Sep 30 '19 07:09 pplu

Ok if that is the case then the test should change to test for case >300

as you say 'invalid XML on non-200 responses'

byterock avatar Oct 01 '19 18:10 byterock