How can I access the Horizon:Error Response after raising error in code
How can I access the Horizon:Error Response after raising error in code
Loading saved threads...
IPEN · External communityPost link
External question — Stellar Stack Exchange
Author: IPEN
Original post: https://stellar.stackexchange.com/questions/4201
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
After an error raised during a Transaction submission with
server.submit_transaction()
how can I access the corresponding
(Horizon Response JSON object)
https://developers.stellar.org/api/errors/response/
in my App's code in order to investigate the
"result_codes"
entry and handle the cause of the error(e.g: tx_insufficient_fee), programatically without halting the execution of my code forcefully (which is what happens now).
Stay Safe
Quote
Report
IPEN · External communityPost link
External answer — Stellar Stack Exchange
Author: IPEN
Original post: https://stellar.stackexchange.com/a/4205
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I figured it out, let's share it with ya'll.
One should use
BaseHorizonError
to catch Exceptions, then iterate
extras.get("result_codes")
entry of the Exception's instance.
I've caught its sub-classes
(exceptions.BadRequestError, exceptions.BadResponseError, etc.)
so far, which seems doesn't contain these atrributes.
PEACE V
Quote
Report
Post Reply
Checking account access…