contributte / datagrid

:muscle: DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc
https://contributte.org/packages/contributte/datagrid/
MIT License
285 stars 189 forks source link

Correct exception type #1042

Open Rixafy opened 1 year ago

Rixafy commented 1 year ago

Hi, shouldn't \Ublaboo\DataGrid\Exception\DataGridException extend \LogicException instead of \Exception?

Because I don't want to propagate nor catch those exceptions, they appear to be in methods like setSortable or setRenderer and my IDE (PhpStorm) is always reporting there is exception that is not handled, but those kind of exceptions are logic exceptions, only if there is a serious bug caused by code, the exceptions should be thrown, and there is no reason to catch them, only avoid them.

image

radimvaculik commented 1 year ago

I'm in. cc @paveljanda @f3l1x

paveljanda commented 1 year ago

It is a good idea. But sadly, not all those exception are Logic. Some could be Runtime.

Rixafy commented 1 year ago

@paveljanda that's cool, because runtime exception is also ignored by default in phpstorm

image