An error is an error. If you expect a certain kind or value of output, but instead you get something else, it's an error. Whether it's valid memory or not.
If you write code that could possibly pass an empty object into your regex constructor, that's an error.. and the fault lies with the programmer who didn't validate.
Passing in an empty object instead of a string is not any more or less of an error than passing in a reference to an empty spot in memory, or just the wrong spot in memory.
I'm trying to figure out how that's relevant to whether or not the programmer should not be passing variables to a function if they haven't verified the appropriate data type first...
Cause you compared it to a segfaults, but segfaults happens for valid reasons that cannot be resolved by the language, this scheiße has exaclty 0 rights to be a thing
So then replace seg fault with literally any other error that developers have complained about not being descriptive or helpful. There are thousands of them..
View all comments
Show parent comment
1
u/subject_deleted Mar 21 '24
If you fuck up, is that not an error?
A message saying you passed an empty object to a regex constructor is just telling you you fucked up...