Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog
PlException Class
SwiPlCs interfaceSbsSW.SwiPlCs.ExceptionsPlException

This class is the base class to catch exceptions thrown by prolog in C#.

Declaration Syntax
C#Visual BasicVisual C++F#
[SerializableAttribute]
public class PlException : Exception, 
	ISerializable
<SerializableAttribute>
Public Class PlException
	Inherits Exception
	Implements ISerializable
[SerializableAttribute]
public ref class PlException : public Exception, 
	ISerializable
[<SerializableAttribute>]
type PlException =  
    class
        inherit Exception
        interface ISerializable
    end
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
PlException()()()()
Initializes a new instance of the Exception class.

PlException(String)
Initializes a new instance of the Exception class with a specified error message.

PlException(String, Exception)
Initializes a new instance of the Exception class with a specified error message and a reference to the inner exception that is the cause of this exception.

PlException(SerializationInfo, StreamingContext)
Initializes a new instance of the Exception class with serialized data.

PlException(PlTerm)

To catch a exception thrown by prolog

For a example see PlException.


Data
Gets a collection of key/value pairs that provide additional user-defined information about the exception.
(Inherited from Exception.)
Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()()
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
GetBaseException()()()()
When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
(Inherited from Exception.)
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetObjectData(SerializationInfo, StreamingContext)
When overridden in a derived class, sets the SerializationInfo with information about the exception.
(Overrides Exception.GetObjectData(SerializationInfo, StreamingContext).)
GetType()()()()
Gets the runtime type of the current instance.
(Inherited from Exception.)
HelpLink
Gets or sets a link to the help file associated with this exception.
(Inherited from Exception.)
HResult
Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.
(Inherited from Exception.)
InnerException
Gets the Exception instance that caused the current exception.
(Inherited from Exception.)
MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Message
Gets a message that describes the current exception.
(Overrides Exception.Message.)
MessagePl
provide somtimes some additional information about the exceptions reason.

PlThrow()()()()
Generate an exception (as throw/1) and return false.

Source
Gets or sets the name of the application or the object that causes the error.
(Inherited from Exception.)
StackTrace
Gets a string representation of the frames on the call stack at the time the current exception was thrown.
(Inherited from Exception.)
TargetSite
Gets the method that throws the current exception.
(Inherited from Exception.)
Term
Get the PlTerm of this exception.

Throw()()()()
TODO

ToString()()()()
The exception is translated into a message as produced by print_message/2. The character data is stored in a ring.
(Overrides Exception.ToString()()()().)
Examples
 Copy imageCopy
public void prolog_exception_sample()
{
    string exception_text = "test_exception";
    Assert.IsTrue(PlQuery.PlCall("assert( (test_throw :- throw(" + exception_text + ")) )"));
    try
    {
        Assert.IsTrue(PlQuery.PlCall("test_throw"));
    }
    catch (PlException ex)
    {
        Assert.AreEqual(exception_text, ex.Term.ToString());
        Assert.AreEqual("Unknown message: " + exception_text, ex.Message);
    }
}
Inheritance Hierarchy
See Also

Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60601.0 (1.1.60601.0)