01: /**************************************************************************/
02: /* N I C E */
03: /* A high-level object-oriented research language */
04: /* (c) Daniel Bonniot 2000 */
05: /* */
06: /* This program is free software; you can redistribute it and/or modify */
07: /* it under the terms of the GNU General Public License as published by */
08: /* the Free Software Foundation; either version 2 of the License, or */
09: /* (at your option) any later version. */
10: /* */
11: /**************************************************************************/package bossa.util;
12:
13: public class UserError extends RuntimeException {
14: public UserError() {
15: if (Debug.alwaysDumpStack)
16: Internal.printStackTrace();
17: }
18:
19: UserError(String message) {
20: this .message = message;
21:
22: if (Debug.alwaysDumpStack)
23: Internal.printStackTrace();
24: }
25:
26: public UserError(Located responsible, String message) {
27: this (responsible.location(), message);
28: }
29:
30: public UserError(gnu.expr.Expression responsible, String message) {
31: this (Location.make(responsible.getFile() == null ? null
32: : new java.io.File(responsible.getFile()), responsible
33: .getLine(), responsible.getColumn()), message);
34: }
35:
36: public UserError(Location location, String message) {
37: this (message);
38: this .location = location;
39: }
40:
41: public String getMessage() {
42: if (location == null)
43: return "\n" + message;
44: else
45: return "\n" + location + ":\n" + message;
46: }
47:
48: public String message;
49: public Location location;
50: }
|