Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

Exception handling loses HTTP errors #37

Closed
TurqW opened this issue Oct 6, 2017 · 1 comment
Closed

Exception handling loses HTTP errors #37

TurqW opened this issue Oct 6, 2017 · 1 comment

Comments

@TurqW
Copy link

TurqW commented Oct 6, 2017

The exception handling (or rather, printing) code in BaseClient.issueGet() and BaseClient.issueDelete() invariably ends up throwing IOExceptions, obscuring the actual exception that occurred.

Sequence of events looks something like:

  • readFromConnection gets response code higher than 400
  • readFromConnection constructs StringBuilder with message from connection
  • readFromConnection's finally block closes the InputStreamReader
    • Closing an InputStreamReader closes the underlying stream.
  • readFromConnection throws newly constructed IOException with helpful message
  • issueGet (or issueDelete) catches the IOException
  • issueGet tries to read from the connection's error stream (which is already closed)
  • issueGet throws new IOException with no information except "stream is closed"
@TurqW
Copy link
Author

TurqW commented Oct 6, 2017

My bad, this has been fixed since the version I'm using.

@TurqW TurqW closed this as completed Oct 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant