home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / js / jsj / classes / netscape / javascript / JSException.java next >
Encoding:
Java Source  |  1998-04-08  |  2.1 KB  |  74 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* ** */
  19.  
  20. package netscape.javascript;
  21.  
  22. /**
  23.  * JSException is an exception which is thrown when JavaScript code
  24.  * returns an error.
  25.  */
  26.  
  27. public
  28. class JSException extends Exception {
  29.     String filename;
  30.     int lineno;
  31.     String source;
  32.     int tokenIndex;
  33.  
  34.     /**
  35.      * Constructs a JSException without a detail message.
  36.      * A detail message is a String that describes this particular exception.
  37.      */
  38.     public JSException() {
  39.     super();
  40.         filename = "unknown";
  41.         lineno = 0;
  42.         source = "";
  43.         tokenIndex = 0;
  44.     }
  45.  
  46.     /**
  47.      * Constructs a JSException with a detail message.
  48.      * A detail message is a String that describes this particular exception.
  49.      * @param s the detail message
  50.      */
  51.     public JSException(String s) {
  52.     super(s);
  53.         filename = "unknown";
  54.         lineno = 0;
  55.         source = "";
  56.         tokenIndex = 0;
  57.     }
  58.  
  59.     /**
  60.      * Constructs a JSException with a detail message and all the
  61.      * other info that usually comes with a JavaScript error.
  62.      * @param s the detail message
  63.      */
  64.     public JSException(String s, String filename, int lineno,
  65.                        String source, int tokenIndex) {
  66.     super(s);
  67.         this.filename = filename;
  68.         this.lineno = lineno;
  69.         this.source = source;
  70.         this.tokenIndex = tokenIndex;
  71.     }
  72. }
  73.  
  74.