As part of 1.x stabilization, Web3 needs a good behavioral description of when and how its error messages are thrown. This is a pre-condition for any more extensive refactoring because it's common for users to grep the errors and base further logic on them. In many cases the message strings themselves have become a de-facto interface that needs to be supported.
Below is a tracking table - line numbers are based on the repo state at 513116fb05428327df35c8c5c9528a678d6f498c. As things change those numbers will likely float a bit.
| Cov | Package | File | Line | PR |
| ---------- | ------- | ------- | ------- | ------ |
| โ | bzz | index.js | 69 | |
| โ | core| index.js | 34 | |
| โ
| helpers | formatters.js | 141 | |
| โ
| helpers | formatters.js | 150 | |
| โ | helpers | formatters.js | 204 | |
| โ | helpers | formatters.js | 263 | |
| โ
| helpers | formatters.js | 471 | |
| โ
| method | index.js | 36 | |
| โ
| method | index.js | 128 | |
| โ | method | index.js | 275 | |
| โ
| method | index.js | 287 | |
| โ
| method | index.js | 345 | |
| โ
| method | index.js | 386 | |
| โ
| method | index.js | 432 | |
| โ
| method | index.js | 447 | |
| โ | method | index.js | 457 | |
| โ | method | index.js | 484 | |
| โ
| method | index.js | 494 | |
| โ | method | index.js | 507 | |
| โ
| method | index.js | 581 | |
| โ
| requestmngr | batch.js | 57 | |
| โ | requestmngr | batch.js | 61 | |
| โ | requestmngr | givenprovider.js | 56 | |
| โ | requestmngr | givenprovider.js | 68 | |
| โ
| requestmngr | index.js | 85 | |
| โ | requestmngr | index.js | 119 | |
| โ
| requestmngr | index.js | 127 | |
| โ | requestmngr | index.js | 158 | |
| โ
| requestmngr | index.js | 170 | |
| โ
| requestmngr | index.js | 174 | |
| โ | requestmngr | index.js | 196 | |
| โ | requestmngr | jsonrpc.js | 42 | |
| โ
| core-subscriptions | subscription.js | 81 | #3190 |
| โ | core-subscriptions | subscription.js | 158 | |
| โ
| core-subscriptions | subscription.js | 198 | #3190 |
| โ
| core-subscriptions | subscription.js | 206 | #3190 |
| โ
| eth-abi | index.js | 239 | |
| โ | eth-accounts | index.js | 82 | |
| โ
| eth-accounts | index.js | 137 | |
| โ
| eth-accounts | index.js | 145 | |
| โ
| eth-accounts | index.js | 151 | |
| โ
| eth-accounts | index.js | 158 | |
| โ
| eth-accounts | index.js | 165 | |
| โ
| eth-accounts | index.js | 230 | |
| โ | eth-accounts | index.js | 269 | |
| โ | eth-accounts | index.js | 336 | |
| โ | eth-accounts | index.js | 342 | |
| โ | eth-accounts | index.js | 356 | |
| โ | eth-accounts | index.js | 361 | |
| โ | eth-accounts | index.js | 368 | |
| โ | eth-accounts | index.js | 403 | |
| โ | eth-accounts | index.js | 408 | |
| โ | eth-accounts | index.js | 546 | |
| โ
| eth-contract | index.js | 59 | #3190 |
| โ
| eth-contract | index.js | 74 | #3365 |
| โ
| eth-contract | index.js | 345 | #3365 |
| โ | eth-contract | index.js | 523 | looks unreachable (#3365) |
| โ | eth-contract | index.js | 537 | looks unreachable (#3365) |
| โ | eth-contract | index.js | 551 | looks unreachable (#3365) |
| โ
| eth-contract | index.js | 604/6 | #3365 |
| โ
| eth-contract | index.js | 650 | #3365 |
| โ
| eth-contract | index.js | 654 | #3365 |
| โ
| eth-contract | index.js | 673 | |
| โ
| eth-contract | index.js | 791 | |
| โ
| eth-contract | index.js | 862 | #3365 |
| โ | eth-contract | index.js | 869 | (looks unreachable #3365) |
| โ
| eth-contract | index.js | 951 | #3365 |
| โ
| eth-contract | index.js | 955 | |
| โ
| eth-ens | ENS.js | 176 | |
| โ
| eth-ens | ENS.js | 182 | |
| โ
| eth-iban | index.js | 105 | |
| โ
| eth-iban | ENS.js | 131 | |
| โ | providers-http | index.js | 107 | |
| โ | providers-http | index.js | 117 | |
| โ | providers-http | index.js | 124 | |
| โ | providers-ipc | index.js | 151 | |
| โ | providers-ipc | index.js | 191 | |
| โ | providers-ipc | index.js | 227 | |
| โ | providers-ipc | index.js | 251 | |
| ๐ | providers-ws | index.js| 62 | Removed in #3190 |
| ๐ | providers-ws | index.js| 203 | Different error in #3190 |
| ๐ | providers-ws | index.js| 240 | Removed in #3190 |
| ๐ | providers-ws | index.js| 255 | Removed in #3190 |
| โ
| providers-ws | index.js| 278 | #3190 |
| โ
| providers-ws | index.js| 282 | #3190 |
| ๐ | providers-ws | index.js| 300 | Removed in #3190 |
| โ | utils | index.js | 122 | |
| โ | utils | index.js | 170 | |
| โ
| utils | index.js | 218 | |
| โ
| utils | index.js | 248 | |
| โ
| utils | index.js | 280 | |
| โ | utils | index.js | 300 | |
@cgewecke Great initiative! Is it planned to create a list of already tested errors here? :)
@nivida That's a really good idea - it might be helpful to have both.
@nivida I've updated the issue with the survey results.
From this point I could start going through in order of priority and writing tests where possible?
Probably each module would be a single PR to reduce merge conflicts and keep it simple.
Many errors are in this format:
throw new Error('You must provide the json interface of the contract when instantiating a contract object.');
Do you think it would be a good idea to define these in web3-core-helpers' error.js and manage all strings there?
Do you think it would be a good idea to define these in web3-core-helpers' error.js and manage all strings there?
@cgewecke I think it makes the most sense to have an error message in the web3-core-helpers package if they are used multiple times. But it will improve the overall error situation if we start to have them at one place for example if we would like to add web3.js error codes do we not to scan the entire code base again. So let us move them as proposed from you in an iterative sense to the web3-core-helpers package and feel free to improve the structure of the web3-core-helpers package if required. ๐ช
| Nr. | Cov | Package | File | Line | PR |
| ------- | ---------- | ------- | ------- | ------- | ------ |
| 1 | โ | providers-ws | index.js| 62 | Removed in #3190 |
| 2 | โ | providers-ws | index.js| 203 | Different error in #3190 |
| 3 | โ | providers-ws | index.js| 240 | Removed in #3190? |
| 4 | โ | providers-ws | index.js| 255 | Removed in #3190? |
| 5 | โ | providers-ws | index.js| 300 | Removed in #3190 |
Ws is always definedConnectionTimeout error. _onClose listener. eventemitter3 dependency does handle this here.This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions
Leaving open because table may be useful....
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.