What I don't like is your mapping of Exception => Status code.

You would not tie your exception to REST, just to an exception interface. It's much easier for the exception to define which status code it should return.

----------------------------------------
Michaël Gallego

Tel. : 06-98-82-62-38
mic.gallego@gmail.com





Le 16 oct. 2013 à 12:03, Marco Pivetta <notifications@github.com> a écrit :

> In src/ZF/ApiProblem/View/ApiProblemStrategy.php:
> 
> >          if (!is_string($result)) {
> >              // We don't have a string, and thus, no JSON
> >              return;
> >          }
> >  
> > -        $model       = $e->getModel();
> > +        $model = $e->getModel();
> >          if (!$model instanceof ApiProblemModel) {
> @bakura10 I really don't like the fact that my (example) core business logic API should be aware of the REST component (DIP violation IMO).
> 
> If I throw a CustomerDataInvalidException then the REST api should convert that into a 400 error.
> If I throw an InvalidAccessLevelException then the api should convert that into a 403 error.
> 
> etc etc...
> 
> —
> Reply to this email directly or view it on GitHub.
>