[erlang-questions] string:substr/2 gives confusing error message
Fri Dec 5 12:27:37 CET 2008
Adding exception raise in this case is typical defensive programming and it
is not good practice in Erlang except pattern match with tagging.
On Fri, Dec 5, 2008 at 12:17 PM, Vlad Dumitrescu <> wrote:
> On Fri, Dec 5, 2008 at 12:12, Hynek Vychodil <>
> > I think it is worthless work add exception raise as last clause on each
> > function when this error occurred in same function.
> >> ()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
> In any case, badarg is the standard exception thrown in similar cases,
> so why not be consistent?
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions