/*******************************************************************************
*                                                                              *
*  File:        RhinoException.java                     Revision:  1.0         *
*                                                                              *
*  Purpose:     base class for exceptions thrown from within sunda.rhino.* li- *
*               brary classes - may once be able to provide information which  *
*               helps localizing an error                                      *
*                                                                              *
*  Creation:    02.09.2001                     Last Modification:  02.09.2001  *
*                                                                              *
*  Platform:    IBM-compatible PC running Windows 98SE                         *
*                                                                              *
*  Environment: Java 1.3, Rhino 1.5                                            *
*                                                                              *
*  Author:      Andreas Rozek           Phone:  ++49 (711) 6770682             *
*               Kirschblütenweg 15      Fax:    -                              *
*             D-70569 Stuttgart         EMail:  Andreas.Rozek@T-Online.De      *
*               Germany                                                        *
*                                                                              *
*  URL:         http://www.Andreas-Rozek.de/                                   *
*                                                                              *
*  Copyright:   this software is published under the  "GNU Lesser General Pub- *
*               lic  License"  (see  "http://www.fsf.org/copyleft/lesser.html" *
*               for additional information)                                    *
*                                                                              *
*  Comments:    (none)                                                         *
*                                                                              *
*******************************************************************************/

package sunda.rhino;

public class RhinoException extends Exception {
  public String Name;         // identifies an exception category for JavaScript

  public RhinoException () {
    super("");                                            // just to be complete

  /**** prepare a "Name" for this exception ****/

    String ClassName = this.getClass().getName();

    int NameIndex = ClassName.lastIndexOf('.');
    if (NameIndex == -1) {
      Name = ClassName;                              // unlikely but possible...
    } else {
      Name = ClassName.substring(NameIndex+1);
    };
  };

  public RhinoException (String Message) {
    super(Message);                                       // just to be complete

  /**** prepare a "Name" for this exception ****/

    String ClassName = this.getClass().getName();

    int NameIndex = ClassName.lastIndexOf('.');
    if (NameIndex == -1) {
      Name = ClassName;                              // unlikely but possible...
    } else {
      Name = ClassName.substring(NameIndex+1);
    };
  };
};

