home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!news.service.uci.edu!network.ucsd.edu!sdcc12!oba!mstankus
- From: mstankus@oba.ucsd.edu (Mark Stankus)
- Newsgroups: sci.math.symbolic
- Subject: Inequalities posting: Errors.m
- Message-ID: <41347@sdcc12.ucsd.edu>
- Date: 20 Nov 92 19:33:41 GMT
- References: <41345@sdcc12.ucsd.edu>
- Sender: news@sdcc12.ucsd.edu
- Organization: Mathematics @ UCSD
- Lines: 69
- Nntp-Posting-Host: oba.ucsd.edu
-
- (* The following package allows an abort to be executed.
- An example of its usage would be
-
- foo defintitions here
- ...
- foo[x___] := BadCall["foo",x];
-
- *)
- (* :Title: Errors // Mathematica 1.2 and 2.0 *)
-
- (* :Author: Mark Stankus (mstankus). *)
-
- (* :Context: Errors` *)
-
- (* :Summary:
- *)
-
- (* :Alias:
- *)
-
- (* :Warnings:
- *)
-
- (* :History:
- *)
- BeginPackage["Errors`"];
-
- Clear[BadCall];
-
- BadCall::usage =
- "BadCall[string,rest] reports an error message \
- indicating that the routine with name \
- given by string was called incorrectly and rest \
- is the nonheaded list of parameters sent to that routine. \
- BadCall records the erroneous arguments. See \
- WhatAreBadArgs. BadCall then makes the aggresive move \
- of calling Abort[]!";
-
- Clear[WhatAreBadArgs];
-
- WhatAreBadArgs::usage =
- "WhatAreBadArgs[] returns the error list of the \
- most recent call to BadCall. See BadCall.";
-
- Begin["`Private`"];
-
- BadCall[name_String,param___] := Block[{},
- Print["Severe error from :-( ",name];
- ErrorArgs = List[param];
- Print["The parameters are (as a list)",Short[ErrorArgs,3]];
- Print["Bad argument can be retrieved by a call to WhatAreBadArgs"];
- Print["\n\n Here is the stack:\n\n\n"];
- Print[Shallow[Stack[_],{2,4}]];
- Abort[];
- ];
-
- BadCall[___] := Block[{},
- Print["If you see this message, send a message to ncalg and"];
- Print["tell us that we have a bad call error."];
- Abort[];
- ];
-
- WhatAreBadArgs[] := ErrorArgs;
-
- End[];
- EndPackage[]
- --
- mstankus
- mstankus@oba
-