PlDomainException Constructor (term)

SbsSW.SwiPlCs

Copy image CopyHover image
Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog PlDomainException Constructor (term)
SwiPlCs interfaceSbsSW.SwiPlCs.ExceptionsPlDomainExceptionPlDomainException(PlTerm)

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

Declaration Syntax
C# Visual Basic Visual C++ F#
public PlDomainException(
	PlTerm term
)
Public Sub New ( 
	term As PlTerm
)
public:
PlDomainException(
	PlTerm term
)
new : 
        term : PlTerm -> PlDomainException
Parameters
term (PlTerm)

[Missing <param name="term"/> documentation for "M:SbsSW.SwiPlCs.Exceptions.PlDomainException.#ctor(SbsSW.SwiPlCs.PlTerm)"]

Examples
  Copy imageCopy
public void prolog_exception_sample()
{
    const string exceptionText = "test_exception";
    Assert.IsTrue(PlQuery.PlCall("assert( (test_throw :- throw(" + exceptionText + ")) )"));
    try
    {
        Assert.IsTrue(PlQuery.PlCall("test_throw"));
    }
    catch (PlException ex)
    {
        Assert.AreEqual(exceptionText, ex.Term.ToString());
        Assert.AreEqual("Unknown message: " + exceptionText, ex.Message);
    }
}

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