From: Adam Chlipala Date: Mon, 25 Feb 2008 00:32:30 +0000 (+0000) Subject: Improve one kind of error message X-Git-Tag: release_2010-11-19~43 X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/commitdiff_plain/b44d16e043c802069df09c5736c2480435e56b9c Improve one kind of error message --- diff --git a/src/describe.sml b/src/describe.sml index 11194af..e5850e2 100644 --- a/src/describe.sml +++ b/src/describe.sml @@ -112,9 +112,9 @@ fun will_be_action (t, _) = fun get_first_arg (t, _) = case t of - TArrow (t', _) => t' + TArrow (t', _) => SOME t' | TUnif (_, ref (SOME t')) => get_first_arg t' - | _ => raise Fail "get_first_arg failed!" + | _ => NONE fun hint te = case te of @@ -137,9 +137,12 @@ fun describe_type_error' loc te = Option.app (describe_unification_error t1) ueo) | WrongForm (place, form, e, t, ueo) => if form = "action" andalso will_be_action t then - (ErrorMsg.error (SOME loc) ("Not enough arguments passed to configuration function. (" ^ place ^ ")"); - preface (" Expression so far:", p_exp e); - preface ("Next argument type:", p_typ (get_first_arg t))) + (case get_first_arg t of + NONE => ErrorMsg.error (SOME loc) "You probably forgot a 'with' clause here." + | SOME t' => + (ErrorMsg.error (SOME loc) ("Not enough arguments passed to configuration function. (" ^ place ^ ")"); + preface (" Expression so far:", p_exp e); + preface ("Next argument type:", p_typ t'))) else (ErrorMsg.error (SOME loc) (place ^ " has a non-" ^ form ^ " type."); preface ("Expression:", p_exp e);