webmozarts / assert

Assertions to validate method input/output with nice error messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: Custom exception class

JustBlackBird opened this issue · comments

It would be useful if the assert can throw instance of custom exception class not only \InvalidArgumentException.

In my usecase every module throws exceptions implementing one extra interface (let's say \Acme\Foo\DomainExceptionInterface). This helps to catch only exception of exact module if it's needed. With current implementation of the library I cannot achieve it.

If the maintainer is interested in resolving this I could provide a PR.

@webmozart I created a PR implementing this feature. Could you please review it?