aboutsummaryrefslogtreecommitdiff
path: root/Tools/MathematicaMisc/Errors.m
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/MathematicaMisc/Errors.m')
-rw-r--r--Tools/MathematicaMisc/Errors.m5
1 files changed, 5 insertions, 0 deletions
diff --git a/Tools/MathematicaMisc/Errors.m b/Tools/MathematicaMisc/Errors.m
index 4de9a65..2f0d6cd 100644
--- a/Tools/MathematicaMisc/Errors.m
+++ b/Tools/MathematicaMisc/Errors.m
@@ -9,6 +9,7 @@ VerifyStringList;
VerifyList;
InfoMessage;
SetDebugLevel;
+ErrorDefinition::usage = "ErrorDefinition[f] creates a default definition of a function f which throws an exception. This can be used to catch programming errors where f is called with incorrect arguments.";
DebugQuiet = 0;
Warnings = 1
@@ -88,6 +89,10 @@ InfoMessage[level_, message__] :=
SetDebugLevel[level_] :=
debugLevel = level;
+ErrorDefinition[x_] :=
+ x[args___] :=
+ ThrowError["Invalid arguments to "<>ToString[x], {args}//FullForm];
+
End[];
EndPackage[];