
#ifndef Exception_H
#define Exception_H

/*
 * This file declares the CL_Exception class.  This class represents a generic
 * exception.	Each class whose methods throw exceptions should throw objects
 * from classes derived from CL_Exception.  For example, the CL_Interpreter
 * class throws CL_InterpreterException objects.  This allows to catch() either
 * specific exception classes, or all of them :
 *
 * catch(CL_Exception&) { ... }	catches all exceptions
 * catch(CL_InterpreterException&) { ... } catches only Interpreter exceptions.
 */

class CL_Exception
{
public:
	CL_Exception(const char *why, const char *where,
						const char *additionalInfo, long errorNumber = 0L,
						const char *errorCode = 0);
	virtual void Display() const;
	virtual const char *ClassName() const { return "CL_Exception"; }

public:	// Data members
	CL_String	_why;
	CL_String	_where;
	CL_String	_additionalInfo;
	long			_errorNumber;		// an error number, application-specific
	CL_String	_errorCode;       // an error code, used for instance to re-
											// trieve an error message from a special
											// file
};

inline CL_Exception::CL_Exception(const char *why,
											const char *where,
											const char *additionalInfo,
											long errorNumber,
											const char *errorCode)
: _why(why), _where(where), _additionalInfo(additionalInfo),
	_errorNumber(errorNumber),
	_errorCode(errorCode)
{
}

#endif // Exception_H

