fix: expose Kraken errors in KrakenException message - #114
Merged
Merged
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
KrakenExceptionstored the errors returned by Kraken but never passed a message toRuntimeException, sogetMessage()returnednull. Tools that report exceptions through their message hid the actual error. For example, runningEarnOverviewExamplewith a rejected API key made Maven print onlynull: KrakenException, and the underlyingEAPI:Invalid keystayed hidden.The constructor now sets the message to the errors joined with
,, e.g.EAPI:Invalid keyorEGeneral:Invalid arguments, EGeneral:Permission denied. For Funding (Beta) HTTP errors, the message is the status code followed by the response body.getErrors()is unchanged. Anullerror list, which Jackson produces when the envelope has noerrorfield, still produces anullmessage instead of throwing aNullPointerException.Testing
KrakenExceptionTestcovers one error, several errors and a missing error list.mvnd -B clean verifypasses: 597 tests.EarnOverviewExamplerun against the live API with an invalid key now fails withAn exception occurred while executing the Java class. EAPI:Invalid key.