[m-dev.] diff: Improve report_lookup_error error message

Peter Ross pro at missioncriticalit.com
Wed Feb 2 00:56:53 AEDT 2005


Hi,


===================================================================


Estimated hours taken: 0.25
Branches: main, version-0_12-branch

library/require.m:
	Change report_lookup_error so that it reports which key
	couldn't be found rather than just reporting the functor of
	the key.

Index: library/require.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/require.m,v
retrieving revision 1.33
diff -u -r1.33 require.m
--- library/require.m	14 Jan 2005 07:21:09 -0000	1.33
+++ library/require.m	1 Feb 2005 13:48:30 -0000
@@ -73,19 +73,12 @@
 report_lookup_error(Msg, K, V) :-
 	KeyType = type_name(type_of(K)),
 	ValueType = type_name(type_of(V)),
-	functor(K, Functor, Arity),
-	( Arity = 0 ->
-		FunctorStr = Functor
-	;
-		string__int_to_string(Arity, ArityStr),
-		string__append_list([Functor, "/", ArityStr], FunctorStr)
-	),
 	string__append_list(
 		[Msg,
 		"\n\tKey Type: ",
 		KeyType,
-		"\n\tKey Functor: ",
-		FunctorStr,
+		"\n\tKey Value: ",
+		string(K),
 		"\n\tValue Type: ",
 		ValueType
 		],
@@ -94,19 +87,12 @@
 
 report_lookup_error(Msg, K) :-
 	KeyType = type_name(type_of(K)),
-	functor(K, Functor, Arity),
-	( Arity = 0 ->
-		FunctorStr = Functor
-	;
-		string__int_to_string(Arity, ArityStr),
-		string__append_list([Functor, "/", ArityStr], FunctorStr)
-	),
 	string__append_list(
 		[Msg,
 		"\n\tKey Type: ",
 		KeyType,
-		"\n\tKey Functor: ",
-		FunctorStr
+		"\n\tKey Value: ",
+		string(K)
 		],
 		ErrorString),
 	error(ErrorString).

-- 
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list