Wednesday, 19 August 2020

What's the best way to deal with error/success messages to show the user?

What I mean is let's say I have a controller to which a user provides some info and if the user provided the wrong info I show them a message but then another controller can show that exact same message, what's the best way to deal with returning the user that error message?Until now I hard coded the message and just damped it with an error to the next function to my global error handler would just do its work and that the value and return it as a result, but hard coding it doesn't seem like a good solution at all.. so now I think of creating a file of few files with with constants of these messages, but I don't know if that's the best way because (for some reason) it feels very lazy and cheap to do it that way...

Submitted August 19, 2020 at 06:38PM by s_trader

No comments:

Post a Comment