KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > dev > js > rhino > ErrorReporter


1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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 Rhino code, released
14  * May 6, 1999.
15  *
16  * The Initial Developer of the Original Code is Netscape
17  * Communications Corporation. Portions created by Netscape are
18  * Copyright (C) 1997-1999 Netscape Communications Corporation. All
19  * Rights Reserved.
20  *
21  * Contributor(s):
22  * Norris Boyd
23  *
24  * Alternatively, the contents of this file may be used under the
25  * terms of the GNU Public License (the "GPL"), in which case the
26  * provisions of the GPL are applicable instead of those above.
27  * If you wish to allow use of your version of this file only
28  * under the terms of the GPL and not to allow others to use your
29  * version of this file under the NPL, indicate your decision by
30  * deleting the provisions above and replace them with the notice
31  * and other provisions required by the GPL. If you do not delete
32  * the provisions above, a recipient may use your version of this
33  * file under either the NPL or the GPL.
34  */

35 // Modified by Google
36

37 // API class
38

39 package com.google.gwt.dev.js.rhino;
40
41 /**
42  * This is interface defines a protocol for the reporting of
43  * errors during JavaScript translation or execution.
44  *
45  * @author Norris Boyd
46  */

47
48 public interface ErrorReporter {
49
50     /**
51      * Report a warning.
52      *
53      * The implementing class may choose to ignore the warning
54      * if it desires.
55      *
56      * @param message a String describing the warning
57      * @param sourceName a String describing the JavaScript source
58      * where the warning occured; typically a filename or URL
59      * @param line the line number associated with the warning
60      * @param lineSource the text of the line (may be null)
61      * @param lineOffset the offset into lineSource where problem was detected
62      */

63     void warning(String JavaDoc message, String JavaDoc sourceName, int line,
64                  String JavaDoc lineSource, int lineOffset);
65
66     /**
67      * Report an error.
68      *
69      * The implementing class is free to throw an exception if
70      * it desires.
71      *
72      * If execution has not yet begun, the JavaScript engine is
73      * free to find additional errors rather than terminating
74      * the translation. It will not execute a script that had
75      * errors, however.
76      *
77      * @param message a String describing the error
78      * @param sourceName a String describing the JavaScript source
79      * where the error occured; typically a filename or URL
80      * @param line the line number associated with the error
81      * @param lineSource the text of the line (may be null)
82      * @param lineOffset the offset into lineSource where problem was detected
83      */

84     void error(String JavaDoc message, String JavaDoc sourceName, int line,
85                String JavaDoc lineSource, int lineOffset);
86
87     /**
88      * Creates an EvaluatorException that may be thrown.
89      *
90      * runtimeErrors, unlike errors, will always terminate the
91      * current script.
92      *
93      * @param message a String describing the error
94      * @param sourceName a String describing the JavaScript source
95      * where the error occured; typically a filename or URL
96      * @param line the line number associated with the error
97      * @param lineSource the text of the line (may be null)
98      * @param lineOffset the offset into lineSource where problem was detected
99      * @return an EvaluatorException that will be thrown.
100      */

101     EvaluatorException runtimeError(String JavaDoc message, String JavaDoc sourceName,
102                                     int line, String JavaDoc lineSource,
103                                     int lineOffset);
104 }
105
Popular Tags