Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-1851 Add ResponseFormatException #143

Merged
merged 1 commit into from
Jun 16, 2016

Conversation

evanweible-wf
Copy link
Contributor

Fixes #131.

Issue

#131

Solution

When a response body cannot be properly decoded/encoded using the Encoding dictated by the content-type header, a ResponseFormatException will now be thrown with a much more descriptive message. The content-type, encoding, and body will be included.

Testing

  • CI passes

Code Review

@trentgrover-wf
@maxwellpeterson-wf
@dustinlessard-wf
@sebastianmalysa-wf
@jayudey-wf

@evanweible-wf evanweible-wf force-pushed the improve-body-decode-error-message branch from cfb316c to 8936c1c Compare June 2, 2016 20:34
@jayudey-wf jayudey-wf changed the title Add ResponseFormatException CP-1851 Add ResponseFormatException Jun 2, 2016
@sebastianmalysa-wf
Copy link

+1 once checks pass.

expect(exception, new isInstanceOf<ResponseFormatException>(),
reason:
'should throw ResponseFormatException if bytes cannot be decoded');
print(exception);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jay pointed out this leftover print and the one above, I'll remove them.

@evanweible-wf evanweible-wf force-pushed the improve-body-decode-error-message branch from 8936c1c to 6206467 Compare June 3, 2016 15:21
@evanweible-wf
Copy link
Contributor Author

@sebastianmalysa-wf I removed a couple of leftover prints (see outdated diff above)

@trentgrover-wf
Copy link
Contributor

+1

@evanweible-wf evanweible-wf modified the milestone: 2.5.0 Jun 10, 2016
@evanweible-wf evanweible-wf force-pushed the improve-body-decode-error-message branch from 6206467 to f8d3e2a Compare June 10, 2016 16:57
@codecov-io
Copy link

codecov-io commented Jun 10, 2016

Current coverage is 99.51%

Merging #143 into master will increase coverage by <.01%

Powered by Codecov. Last updated by 9f0e2d5...fb7bd0a

@evanweible-wf
Copy link
Contributor Author

@trentgrover-wf @sebastianmalysa-wf rebased and squashed, looks like the coverage comment is working but the CI check is not. No idea why, but I'll figure it out separately.

@dustinlessard-wf
Copy link

+1

@evanweible-wf evanweible-wf modified the milestones: 2.4.1, 2.5.0 Jun 10, 2016
@maxwellpeterson-wf
Copy link
Member

+1

@evanweible-wf evanweible-wf force-pushed the improve-body-decode-error-message branch 2 times, most recently from f17b88e to 3724866 Compare June 15, 2016 20:29
@trentgrover-wf
Copy link
Contributor

looks like there's now a couple of test failures

@evanweible-wf
Copy link
Contributor Author

@trentgrover-wf waiting for #152

@evanweible-wf evanweible-wf force-pushed the improve-body-decode-error-message branch from 3724866 to 5e2ef32 Compare June 16, 2016 17:17
@evanweible-wf
Copy link
Contributor Author

Hmm, the push build is failing and it smells like the content-shell issue that cropped up again with Dart 1.17.0, but the build says it's running 1.17.1... we'll see if the re-run passes

@evanweible-wf
Copy link
Contributor Author

Must have been a fluke, both builds passing now.

@trentgrover-wf @maxwellpeterson-wf @dustinlessard-wf @sebastianmalysa-wf

@maxwellpeterson-wf
Copy link
Member

+1

@trentgrover-wf
Copy link
Contributor

+1
@jayudey-wf ready for merge

@evanweible-wf evanweible-wf force-pushed the improve-body-decode-error-message branch from 5e2ef32 to 8b45779 Compare June 16, 2016 18:52
expect(exception.toString(), contains('Body could not be encoded'));
expect(exception.toString(), contains('Content-Type: $contentType'));
expect(exception.toString(), contains('Encoding: ${ASCII.name}'));
expect(exception.toString(), contains('bodyçå®'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added these last 4 expectations to test the message ^

expect(exception.toString(), contains('Bytes could not be decoded'));
expect(exception.toString(), contains('Content-Type: $contentType'));
expect(exception.toString(), contains('Encoding: ${ASCII.name}'));
expect(exception.toString(), contains(UTF8.encode('bodyçå®').toString()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added these last 4 expectations to test the message ^

@evanweible-wf
Copy link
Contributor Author

evanweible-wf commented Jun 16, 2016

@trentgrover-wf @maxwellpeterson-wf @dustinlessard-wf @sebastianmalysa-wf

I updated the two tests to include additional asserts that exercise the .toString() of the new exception. The changes should be 100% covered now.

Thanks @jayudey-wf for catching that!

@maxwellpeterson-wf
Copy link
Member

+1

- Improve error messaging when response body cannot be decoded/encoded
@evanweible-wf evanweible-wf force-pushed the improve-body-decode-error-message branch from 8b45779 to fb7bd0a Compare June 16, 2016 19:32
@evanweible-wf
Copy link
Contributor Author

@maxwellpeterson-wf
Copy link
Member

+1

@trentgrover-wf
Copy link
Contributor

+1
@jayudey-wf ready for merge

@jayudey-wf
Copy link
Contributor

jayudey-wf commented Jun 16, 2016

QA Resource Approval: +10

  • Testing instruction
  • Dev +1's
  • Dev/QA +10 with detail of what was tested
    • passing CI running tests that exercise new functionality
  • Unit test created/updated
  • All unit tests pass

Merging into master.

@jayudey-wf jayudey-wf merged commit f88681d into master Jun 16, 2016
@evanweible-wf evanweible-wf deleted the improve-body-decode-error-message branch July 22, 2016 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants