Source code: netscape/jsdebug/JSErrorReporter.java
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * The contents of this file are subject to the Netscape Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/NPL/
7 *
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
12 *
13 * The Original Code is mozilla.org code.
14 *
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation. Portions created by Netscape are
17 * Copyright (C) 1998 Netscape Communications Corporation. All
18 * Rights Reserved.
19 *
20 * Contributor(s):
21 */
22
23 package netscape.jsdebug;
24
25 /**
26 * This is a special kind of hook to respond to JavaScript errors
27 *
28 * @author John Bandhauer
29 * @version 1.0
30 * @since 1.0
31 */
32 public interface JSErrorReporter
33 {
34 /* keep these in sync with the numbers in jsdebug.h */
35
36 /**
37 * returned by <code>reportError()</code> to indicate that the error
38 * should be passed along to the error reporter that would have been
39 * called had the debugger not been running
40 */
41 public static final int PASS_ALONG = 0;
42 /**
43 * returned by <code>reportError()</code> to indicate that the
44 * normal error reporter should not be called and that the JavaScript
45 * engine should do whatever it would normally do after calling the
46 * error reporter.
47 */
48 public static final int RETURN = 1;
49 /**
50 * returned by <code>reportError()</code> to indicate that the
51 * 'debug break' hook should be called to allow the debugger to
52 * investigate the state of the process when the error occured
53 */
54 public static final int DEBUG = 2;
55
56 /**
57 * This hook is called when a JavaScript error (compile or runtime) occurs
58 * <p>
59 * One of the codes above should be returned to tell the engine how to
60 * proceed.
61 * @param msg error message passed through from the JavaScript engine
62 * @param filename filename (or url) of the code with the error
63 * @param lineno line number where error was detected
64 * @param linebuf a copy of the line where the error was detected
65 * @param tokenOffset the offset into <i>linebuf</i> where the error
66 * was detected
67 * @returns one of the codes above
68 */
69 public int reportError( String msg,
70 String filename,
71 int lineno,
72 String linebuf,
73 int tokenOffset );
74 }