Skip to main content
edited title
Link
PPPHP
  • 143
  • 1
  • 4

Business rule /rules, business logic errors, input validation.

Source Link
PPPHP
  • 143
  • 1
  • 4

Business rule / business logic errors.

This might be asked a thousand times but couldn't find the answer. I just wonder how you people handle the business logic errors? Im trying to do a nice api for my business model. Some methods have quite a lot of validation and I just wonder how should I report them if something goes wrong? Returning true or false or null sometimes won't say what was the actual cause. Sometimes it works sometimes it is not enough. I read that some people use exceptions. I've thought that I could return error messages and when everything goes fine then it would be null. Somehow error codes just don't add up for me..