dfuncd / repofuck

Fucking with the Repository Design Pattern
6 stars 2 forks source link

Possible uncaught exception in `resetEntity()`. #70

Closed makoru-hikage closed 7 years ago

makoru-hikage commented 8 years ago

Such method (L161, Repofuck.php) is only a two liner. It accepts a string to set the current entity.

This line (L163, Repofuck.php) throws an EntityNotDefined exception when it is supplied with an undefined entity (L97, Entities.php): $this->entity = $this->entities->resolve($name);

Should such line throw an exception, the resetEntity() might go awry; it has no try-catch statement. If a try-catch statement is made, how shall the method go when something is caught? Shall the current entity be untouched? Shall it be returning a false?

I am not sure of what will be.

makoru-hikage commented 8 years ago

However, the exception can be caught at the user's end.

makoru-hikage commented 7 years ago

resetEntity() is now deprecated. Also end-user must catch the aforementioned Exception.

See commit #75.