error-or icon indicating copy to clipboard operation
error-or copied to clipboard

Suggestion: Adding of ErrorType.Domain (or ErrorType.UseCase or ErrorType.BusinessRule)

Open yasirthite opened this issue 2 years ago • 1 comments

Hi @amantinband , Thank you very much for developing this library. Got to know about it from your video series. Let me know your thoughts on adding a special error type ErrorType.Domain to represent errors related specific to business rules instead of just ErrorType.Custom. This is because, if its an Error it indeed means a type of Failure so instead of just ErrorType.Failure if we use ErrorType.Domain, it signifies failure in some use case / business rule validation. Example, consider this business rule: User cannot add/upload more than 3 products to sell under his/her current FREE subscription. Can you please share your thoughts on this.

yasirthite avatar Aug 15 '22 04:08 yasirthite

Hi, you can use the NumericType property on Error with ErrorType.Custom. Then you can have your enum with other types of errors, like Domain, BusinessRule, etc. Then you can check the error NumericType against this enum.

vpekarek avatar Aug 16 '22 05:08 vpekarek

Thank you @vpekarek. Recently realized it.

yasirthite avatar Aug 19 '22 12:08 yasirthite