Fix Pervasives.undefined for use case with optional parameter

Otherwise the failwith (which got type string -> ('b -> 'c) here)
will be evaluated when the message parameter is passed.
Now it gets type 'a -> 'b and is evaluated only when both parameters are passed.