mybb / mybb2

The repository for the MyBB 2 forum software. Not to be used on live boards.
https://www.mybb.com
BSD 3-Clause "New" or "Revised" License
109 stars 45 forks source link

#63 Add proper Exceptions #70

Closed JN-Jones closed 9 years ago

JN-Jones commented 9 years ago

63

Before I start adding exceptions everywhere I would like to know whether this is what you want or whether you want something else @euantorano @wpillar

Note: The functions in the exception handler are the same as in the parent handler so there wasn't any need for them.

JN-Jones commented 9 years ago

Any comment?

euantorano commented 9 years ago

Yep, looks right to me :) Any reason you removed the handler functions though?

JN-Jones commented 9 years ago

Note: The functions in the exception handler are the same as in the parent handler so there wasn't any need for them.

The parent class has exactly the same checks. Should we need them we can easily readd them later.

euantorano commented 9 years ago

Ah, must have missed that. Otherwise, this looks perfectly fine to me. I won't merge it, so that you can do any other instances in the same PR.

JN-Jones commented 9 years ago

I think I've found all exceptions. As soon as this get's merged I'm going to change the packages too.

JN-Jones commented 9 years ago

@euantorano @wpillar Can we merge this?

wpillar commented 9 years ago

Sure, only comment is that the only thing that's different between all of the new Exception classes is protected $message = 'errors.topic_not_found'; the message variable.

Could abstract the constructor to make it easier to create new Exceptions of this nature, but this shouldn't block a merge. Just a thought.

JN-Jones commented 9 years ago

The main Problem is that the constructors are all different. Exception and RuntimeException have the same, NotFoundHttpException has another, the other Http Exceptions have also different etc. We could add AbstractTranslatable*Exceptions but we would end with multiple ones for different exceptions. Also this way we can easily add custom things like I did with the captcha Exception.

wpillar commented 9 years ago

Cool :)