2 ms·
It depends on what contract you have with the function caller. For example, assertions/panics are fine for reporting programmer's errors (i.e. situations that
by pornel 5y ago
It depends on what contract you have with the function caller.
For example, assertions/panics are fine for reporting programmer's errors (i.e. situations that happen due to a bug in the software, not due to runtime environment). There's no point to force programmers to write error-handling branches that will never be used in a properly written program.
This is the reason why methods like `split_at` just panic if you give them a wrong index. You're not supposed to make invalid indices in the first place.