Skip to content

feat: move custom errors from libraries to interfaces for external accessibility (#57)#89

Merged
mudgen merged 5 commits into
Perfect-Abstractions:mainfrom
ogazboiz:feat/move-errors-to-interfaces
Oct 22, 2025
Merged

feat: move custom errors from libraries to interfaces for external accessibility (#57)#89
mudgen merged 5 commits into
Perfect-Abstractions:mainfrom
ogazboiz:feat/move-errors-to-interfaces

Conversation

@ogazboiz

Copy link
Copy Markdown
Contributor

This PR moves custom errors from internal libraries to public interfaces, making them accessible to external users.

Fixes #57

Problem:
Custom errors were buried in libraries. UI developers had no canonical access to these errors. They had to reimplement errors elsewhere, introducing inconsistencies and making Compose adoption difficult.

Solution:
Created interface files with all custom errors in src/interfaces/ directory. Updated libraries and facets to use local error definitions instead of importing from interfaces.

Changes:
• Created IERC20.sol with all ERC20 custom errors
• Created IERC721.sol with all ERC721 custom errors
• Created IERC721Enumerable.sol with all ERC721Enumerable custom errors
• Created IERC173.sol with all ERC173 custom errors
• Updated all libraries to use local error definitions
• Updated all facets to use local error definitions
• Added proper author attribution to all interface files

Benefits:
• External users get direct access to custom errors via interfaces
• UI developers have canonical error definitions
• Follows industry standard of declaring errors in interfaces
• Maintains full backward compatibility
• All tests pass

Technical Details:
All error references use the original format (e.g., ERC20InsufficientBalance(...)). Interface files are standalone for external users only. All internal code uses local error definitions.

cc: @mudgen

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

I am sorry, we are not using the author natspec tag.

@ogazboiz

ogazboiz commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

I will remove that instead I thought I removed that
@mudgen

@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

Thanks!

@ogazboiz

Copy link
Copy Markdown
Contributor Author

@mudgen i have remove that

@mudgen mudgen merged commit 782b51f into Perfect-Abstractions:main Oct 22, 2025
1 check passed
@mudgen

mudgen commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@ogazboiz I see that your commits show up in the contributors section now. That's great.
https://github.com/Perfect-Abstractions/Compose/graphs/contributors

JackieXu pushed a commit to JackieXu/Compose that referenced this pull request Nov 6, 2025
…rors-to-interfaces

feat: move custom errors from libraries to interfaces for external accessibility (Perfect-Abstractions#57)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal - Move ERC20 and other errors to interfaces

2 participants