| 1 | /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 2 | * |
| 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 | |
| 7 | |
| 8 | package org.mozilla.javascript; |
| 9 | |
| 10 | /** |
| 11 | * The class of exceptions thrown by the JavaScript engine. |
| 12 | */ |
| 13 | public class EvaluatorException extends RhinoException |
| 14 | { |
| 15 | static final long serialVersionUID = -8743165779676009808L; |
| 16 | |
| 17 | public EvaluatorException(String detail) |
| 18 | { |
| 19 | super(detail); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Create an exception with the specified detail message. |
| 24 | * |
| 25 | * Errors internal to the JavaScript engine will simply throw a |
| 26 | * RuntimeException. |
| 27 | * |
| 28 | * @param detail the error message |
| 29 | * @param sourceName the name of the source reponsible for the error |
| 30 | * @param lineNumber the line number of the source |
| 31 | */ |
| 32 | public EvaluatorException(String detail, String sourceName, |
| 33 | int lineNumber) |
| 34 | { |
| 35 | this(detail, sourceName, lineNumber, null, 0); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Create an exception with the specified detail message. |
| 40 | * |
| 41 | * Errors internal to the JavaScript engine will simply throw a |
| 42 | * RuntimeException. |
| 43 | * |
| 44 | * @param detail the error message |
| 45 | * @param sourceName the name of the source responsible for the error |
| 46 | * @param lineNumber the line number of the source |
| 47 | * @param columnNumber the columnNumber of the source (may be zero if |
| 48 | * unknown) |
| 49 | * @param lineSource the source of the line containing the error (may be |
| 50 | * null if unknown) |
| 51 | */ |
| 52 | public EvaluatorException(String detail, String sourceName, int lineNumber, |
| 53 | String lineSource, int columnNumber) |
| 54 | { |
| 55 | super(detail); |
| 56 | recordErrorOrigin(sourceName, lineNumber, lineSource, columnNumber); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @deprecated Use {@link RhinoException#sourceName()} from the super class. |
| 61 | */ |
| 62 | @Deprecated |
| 63 | public String getSourceName() |
| 64 | { |
| 65 | return sourceName(); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @deprecated Use {@link RhinoException#lineNumber()} from the super class. |
| 70 | */ |
| 71 | @Deprecated |
| 72 | public int getLineNumber() |
| 73 | { |
| 74 | return lineNumber(); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @deprecated Use {@link RhinoException#columnNumber()} from the super class. |
| 79 | */ |
| 80 | @Deprecated |
| 81 | public int getColumnNumber() |
| 82 | { |
| 83 | return columnNumber(); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @deprecated Use {@link RhinoException#lineSource()} from the super class. |
| 88 | */ |
| 89 | @Deprecated |
| 90 | public String getLineSource() |
| 91 | { |
| 92 | return lineSource(); |
| 93 | } |
| 94 | |
| 95 | } |