01: /*
02: * TclNumArgsException.java
03: *
04: * Copyright (c) 1997 Sun Microsystems, Inc.
05: *
06: * See the file "license.terms" for information on usage and
07: * redistribution of this file, and for a DISCLAIMER OF ALL
08: * WARRANTIES.
09: *
10: * RCS: @(#) $Id: TclVarException.java,v 1.1.1.1 1998/10/14 21:09:19 cvsadmin Exp $
11: *
12: */
13:
14: package tcl.lang;
15:
16: /**
17: * This exception is used to report variable errors in Tcl.
18: */
19:
20: class TclVarException extends TclException {
21:
22: /**
23: * Creates an exception with the appropiate Tcl error message to
24: * indicate an error with variable access.
25: *
26: * @param interp currrent interpreter.
27: * @param name1 first part of a variable name.
28: * @param name2 second part of a variable name. May be null.
29: * @param operation either "read" or "set".
30: * @param reason a string message to explain why the operation fails..
31: */
32:
33: TclVarException(Interp interp, String name1, String name2,
34: String operation, String reason) {
35: super (TCL.ERROR);
36: if (interp != null) {
37: interp.resetResult();
38: if (name2 == null) {
39: interp.setResult("can't " + operation + " \"" + name1
40: + "\": " + reason);
41: } else {
42: interp.setResult("can't " + operation + " \"" + name1
43: + "(" + name2 + ")\": " + reason);
44: }
45: }
46: }
47: }
|