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

Vlad Dumitrescu vladdu55@REDACTED
Fri Dec 5 11:12:28 CET 2008


Hi!

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

(w@REDACTED)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