<!-- canonical: https://0xsimao.com/findings/maple-finance-iii-solidity-native-implementation-string -->

# Throughout code base: use Solidity native errors implementation instead of string errors.

Low/Info · Three Sigma · Institutional lending · 10th April, 2024

Finding 3S-MAPLE-N08 of the Maple Finance security review.

- Protocol: https://maple.finance/
- Report: /reports/maple-finance-iii-2024
- Source: https://cdn.sanity.io/files/qoqld077/production/36dbe5ca76da3d2392bcee581548067705b8bd36.pdf

---

### Description

Solidity allows for their implementation [of native custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) that is more gas-efficient
than using a string within the require function to explain to the user where the call
reverted (the way it's implemented in the Maple Protocol right now).
We understand that string errors might be used to give more information on where the call
reverted; however, this information can still be passed to the user by having specifically
named errors.

### Recommendation

Use custom errors, for example, use
MapleLoan_AcceptBorrower_NotPendingBorrowerError() instead of throwing
"ML:AB:NOT_PENDING_BORROWER".

### Status

Acknowledged, would break Maple's convention so sticking with requires.

---

Related findings:

- [OstiumPriceUpKeep Verifies Reports Using Native Token Instead of LINK](https://0xsimao.com/findings/ostium-price-verifies-reports-native): Ostium
- [Spelling errors throughout the codebase](https://0xsimao.com/findings/singularity-spelling-errors-throughout-codebase): Singularity
- [Throughout code base, implement using SafeERC20 for IERC20 for better readability](https://0xsimao.com/findings/fuji-finance-erc20-ierc20-better-readability): Fuji Finance
- [Custom errors should be used instead of require() statements to save gas](https://0xsimao.com/findings/metazero-ii-custom-require-statements-gas): MetaZero Staking
