3commas-io / 3commas-official-api-docs

Official Documentation for the 3commas APIs
https://3commas.io
247 stars 87 forks source link

Improve errors: Create internal error codes uniquely describing what the error is #143

Open sgerodes opened 2 years ago

sgerodes commented 2 years ago

It is tedious to automate error handling. My proposition is to create error codes (NOT http codes) that will precisely describe what happened. In addition to the existing error messages. All codes should be uniquely assigned to specific errors. Once created codes should not change, for backward compatibility. Better add new.

Examples:

e.g, 25 is 'API keys are no longer valid or incorrect' { "msg": "Other error occurred: record_invalid Invalid parameters {'api_key': ['API keys are no longer valid or incorrect. If you have just created this key, please wait 30 seconds and try again.']}.", "internal_error_codes": [ 25 ] }

Multiple error occured: { "msg": "....", "internal_error_codes": [ 67, 21, 2 ] }