Explain Error Handling
See original GitHub issueHi @kroitor and @xpl and all the developers of ccxt.
I’m have a few questions about error handling in ccxt. So there are ~two~ three main methods that are in the source of most exchanges for handling errors:
handleErrors
throwErrorOnException
request
I gather that handleErrors called in fetch and throwErrorOnException is called pretty much anywhere. However I also see some errors get thrown in request and I’m not really sure if they should be raised there.
Could someone explain how these two methods are supposed to work together. Moreover, @kroitor was talking about only parsing JSON once before but I’m not sure where this should take place. Is
All the best, frosty
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:13 (13 by maintainers)
Top Results From Across the Web
What is Error Handling? - Definition from Techopedia
Error handling refers to the response and recovery procedures from error conditions present in a software application. In other words, it is the...
Read more >What is Exception Handling? - SearchSoftwareQuality
Exception handling is the process of responding to unwanted or unexpected events when a computer program runs. Exception handling deals with these events...
Read more >Exception handling - Wikipedia
In computing and computer programming, exception handling is the process of responding to the occurrence of exceptions – anomalous or exceptional conditions ......
Read more >Definition of error handling - PCMag
Error handling refers to the routines in a program that respond to abnormal input or conditions. The quality of such routines is based...
Read more >How to implement complete error handling? - Codegrip
Error handling is when your software is capable to counter or confiscate errors that may have been brought on by a programmer mistake...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As I’ve got the question was about dropping http status text, not about http status code. The code is needed, indeed. The text (i.e.
reason
) is not used.What I would actually do (when the flow is unified) is switch
handleErrors
signature to options pattern, it’d make us flexible in args. Still, as far as I remember there were some tensions on Python side.It’s called by
handleErrors
anyway. Feel free to move it, although it either won’t be as concise or will parse json twice.Because sometimes we expect json (and we should throw if json is not received) and sometimes we expect plaintext (and should proceed if json is not received). Alternatively, it could be something like: