RPC errors raised by each command

1

Coming from this question, is there any comprehensive collection of what errors can each RPC command return?

For example. Let's say I want to run getbestblockhash or getblockcount. I'm unsure about what errors to expect. Furthermore, I'm unsure if there's a generic error code that can be return in many cases (RPC_MISC_ERROR for example).

sr-gi

Posted 2019-11-18T16:23:09.693

Reputation: 2 382

Answers

2

Coming from this question, is there any comprehensive collection of what errors can each RPC command return?

For example. Let's say I want to run getbestblockhash or getblockcount. I'm unsure about what errors to expect.

I don't think that such documentation exists. You would have to read the source code for a particular RPC. Additionally, since some functions are shared between RPCs and can return specific errors, it may not be easy to enumerate all of the errors.

Furthermore, I'm unsure if there's a generic error code that can be return in many cases (RPC_MISC_ERROR for example).

If there's an error which doesn't have its own specific catching and checking (i.e. an exception is thrown that the RPC doesn't catch), then RPC_MISC_ERROR will be returned.

Andrew Chow

Posted 2019-11-18T16:23:09.693

Reputation: 40 910

Thanks Andrew. I'll wait a bit to see if someone has done the heavy lifting :( Am I at least safe to assume that any unexpected error will default to RPC_MISC_ERROR ?sr-gi 2019-11-18T16:46:15.313

1Yes, you can assume that unexpected errors default to RPC_MISC_ERROR.Andrew Chow 2019-11-18T16:49:05.500