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

Vlad Dumitrescu <>
Fri Dec 5 11:12:28 CET 2008


Hi!

Calling string:substr/2 with erroneous arguments gives a
non-informative error message

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

Shouldn't it be badarg instead, or something similar?

Also, the strings module documentation doesn't mention what are the
cases when the function will fail. (A quick glance shows that there
are other functions in the same situation).

best regards,
Vlad



More information about the erlang-questions mailing list