New answers tagged

0

The Null pointer check is good for un-allocated data as the allocation methods return zero if they fail. It's not much use for random garbage of unset pointers or data overwrites. If the system supports it, find the actual memory range and check for the pointer being in that range, or ranges. If the target is an embedded device (microcontroller) the RAM and ...


1

Is what I am doing right? So for simple validation rules to check that in the web layer and return a 400 error but in case of more complicated business rules to return a 500 error? Probably not. See RFC 7231 The 4xx (Client Error) class of status code indicates that the client seems to have erred. In your case, the client error is that it sent a ...


1

5xx family codes are server errors. They imply server or transport layer malfunction. 4xx codes mean client did something wrong and the server refuses to process his request. None of the cases you described fit the 5xx code family. You should not disallow your Adult class to contain invalid age (actualy You dont need two classes for this) . But rather make ...


1

So basically if the user tries to create an adult with no name it will return a 400 Error but if he tries to create a user with an age less than 18 pass the dto validation and will return a 500 Error. Such validation shouldn't be handled at the transprt layer (HTTP in this case) at all. You should shift such error messages to your API protocol (the payload)....


Top 50 recent answers are included