[erlang-questions] string:substr/2 gives confusing error message

Vlad Dumitrescu vladdu55@REDACTED
Fri Dec 5 12:17:45 CET 2008


On Fri, Dec 5, 2008 at 12:12, Hynek Vychodil <vychodil.hynek@REDACTED> wrote:
> I think it is worthless work add exception raise as last clause on each
> function when this error occurred in same function.

>> (w@REDACTED)1> string:substr([], 2).
>> ** exception error: no function clause matching string:substr2([],2)

Except it's not the same function: notice the error refers to string2,
not to string.

Yes, it's relatively easy to check the code and see what's going
wrong, but then any documentation is redundant, as one could check the
code...

In any case, badarg is the standard exception thrown in similar cases,
so why not be consistent?

regards,
Vlad



More information about the erlang-questions mailing list