Skip to main content
10 events
when toggle format what by license comment
Oct 15, 2020 at 8:23 comment added Vincent PHILIPPE Validation is actually managed by my ServiceProxyValidator Service (One by service). So the service manage the eventual error of user input. This is not the responsibility of the view to know about some validation logic related to the database. I'm sorry... I think I just didn't understand what you meant. Anyway, I think I'll not use Exception anymore as you say, and I'll go for an exception handler based on event dispatch by services. It avoid using exception and make it possible to use translation, and provide context to error.
Oct 15, 2020 at 8:15 comment added Ewan no you don't those are validation errors
Oct 15, 2020 at 8:14 comment added Vincent PHILIPPE It'll lead to return an insane quantity of error code for each services. Because I need to know what happend to display a user error message in the view
Oct 15, 2020 at 8:14 comment added Ewan if you cant send emails that's a message for the developer, not the user, the user can just have "something went wrong!"
Oct 15, 2020 at 8:12 comment added Ewan dont communicate via throwing exceptions. return a result from your function call and translate that result in the UI
Oct 15, 2020 at 8:10 comment added Vincent PHILIPPE If a mail fail to be sent, i cannot just let the website crash with a 500 error. I should say to the user to retying again later as an example.
Oct 15, 2020 at 8:08 comment added Vincent PHILIPPE So how does my services should communicate the encoutered errors to the controller, so the controller will display it in a user friendly way (like alert message)
Oct 15, 2020 at 8:05 comment added Ewan yes that what i think you are doing wrong
Oct 15, 2020 at 8:05 comment added Vincent PHILIPPE Actually my exceptions are used to return error message for user to show. That's why I think about inheritance so I can filter user friendly message with translation + context, and on the other hand, technical exceptions for programmer sees. Maybe I'm not taking the right way, but I don't know how I could return multiple error message on a validation service without using exception. They are handy because they prevent the code for being executed. It make the code IMO more readable
Oct 14, 2020 at 17:53 history answered Ewan CC BY-SA 4.0