First of all, nice work, I really loved your implementation clean architecture, since I'm huge fan of Uncle Bob's.
I do implement and follow those rulesets in my node projects.
Anyway, onto the problem.
F.e. when making request with an invalid quantity value, validator throws an error.
Error is handled on service, but in incorrect way.
When validator throws an error, it sets return values to nil, error, then on service function tries to access unaccessible area(nil in our case) and throws runtime error.
This can be fixed by not accessing unaccessible element(b.ID).
Hey,
First of all, nice work, I really loved your implementation clean architecture, since I'm huge fan of Uncle Bob's. I do implement and follow those rulesets in my node projects.
Anyway, onto the problem. F.e. when making request with an invalid quantity value, validator throws an error. Error is handled on service, but in incorrect way.
Code snipped from area of issue:
When validator throws an error, it sets return values to
nil, error
, then on service function tries to access unaccessible area(nil in our case) and throws runtime error.This can be fixed by not accessing unaccessible element(b.ID).
Cheers, Adam.