solidity-docgen icon indicating copy to clipboard operation
solidity-docgen copied to clipboard

Support custom errors

Open PaulRBerg opened this issue 4 years ago • 3 comments

Custom errors cannot be configured to be included in the Markdown report.

When I run solidity-docgen over a contract with lots of custom errors (such as the BalanceSheet), the custom errors are not included in the output.

PaulRBerg avatar Dec 08 '21 16:12 PaulRBerg

Thanks for pointing this out! I'd like to fix this, hope I get the time. :pray:

frangio avatar Dec 10 '21 13:12 frangio

@paulrberg This is solved in the upcoming rewrite (#350). I'll try it out with the contract that you shared!

Can you share an example of what you'd like the output to look like for errors?

frangio avatar Jan 18 '22 22:01 frangio

This is solved in the upcoming rewrite (#350)

Glad to hear.

Can you share an example of what you'd like the output to look like for errors?

Well custom errors are annotated with NatSpec comments, just like any other function. So treating them as functions would be a good solution to start with. The only difference would be that the errors would be placed under another upper header "Custom Errors", and not under "Functions".

To take BalanceSheet__BorrowMaxBonds as an example, this is the Markdown output that I would like to see when using our Handlebars template:

## Custom Errors

### BalanceSheet__BorrowMaxBonds

\```solidity
error BalanceSheet__BorrowMaxBonds(
    IHToken bond,
    uint256 newBondListLength,
    uint256 maxBonds
);
\```

Emitted when the account exceeds the maximum numbers of bonds permitted.

PaulRBerg avatar Jan 19 '22 13:01 PaulRBerg