/*========================================================================
Copyright (C) 2006 by Geir-Tore Lindsve, Torbjørn Meistad
and Yngve Raudberget, hereby refered to as "the authors".
All rights reserved
Permission is hereby granted, without written agreement and without
license or royalty fees, to use, reproduce, prepare derivative
works, distribute, and display this software and its documentation
for NONCOMMERCIAL RESEARCH AND EDUCATIONAL PURPOSES, provided
that (1) the above copyright notice and the following two paragraphs
appear in all copies of the source code and (2) redistributions,
including without limitation binaries, reproduce these notices in
the supporting documentation.
IN NO EVENT SHALL THE AUTHORS, OR DISTRIBUTORS OF THIS SOFTWARE
BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE
AND ITS DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE
PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
========================================================================*/
using System;
using System.Collections.Generic;
using System.Text;
namespace CLab.Exceptions
{
///
/// Custom exception class triggered by invalid parsing during the building of expressions.
///
class ClabInvalidExpressionException : Exception
{
int expressionType;
String textValue;
int? integerValue = null;
///
/// Initializes a new instance of the class.
///
/// Type of the expression.
/// The text value.
public ClabInvalidExpressionException(int expressionType, String textValue)
{
this.expressionType = expressionType;
this.textValue = textValue;
}
///
/// Initializes a new instance of the class.
///
/// Type of the expression.
/// The integer value.
public ClabInvalidExpressionException(int expressionType, int integerValue)
{
this.expressionType = expressionType;
this.integerValue = integerValue;
}
///
/// Gets a message that describes the current exception.
///
///
/// The error message that explains the reason for the exception.
public override string Message
{
get
{
switch (this.expressionType)
{
case 1:
return (String.Format("'Something went wrong during building of an internal ID expression object during XML parsing.\n" +
"element: {0}\nIs it enclosed in either a left or right tag?", this.textValue));
case 2:
return (String.Format("'Something went wrong during building of an internal Integer expression object during XML parsing.\n" +
"element: {0}\nIs it enclosed in either a left or right tag?", this.integerValue));
case 3:
return (String.Format("Something went wrong during building of an internal componed expression object during XML parsing.\n" +
"Encountered an unhandled right tag."));
case 4:
return (String.Format("Something went wrong when finalizing building of an internal rule expression.\n" +
"Bad depth ({0}) returned at end of rule decleration.", this.integerValue));
default:
return "nonspecified InvalidExpressionException";
}
}
}
}
}