TypeError

class TypeError: PrologError

The type error occurs when something is not of Expected type

Fields

Name Description
val type: Struct

The error type structure

val expectedType: Expected

The type expected, that wouldn't have raised the error

val actualValue: Term

The value not respecting expectedType

Constructors

<init>

constructor(context: ExecutionContext, procedure: Signature, expectedType: Expected, actualValue: Term, index: Int?)

This constructor automatically fills message field with provided information

Parameters

Name Description
context: ExecutionContext
procedure: Signature
expectedType: Expected
actualValue: Term
index: Int?

<init>

constructor(message: String?, cause: Throwable?, context: ExecutionContext, expectedType: Expected, actualValue: Term, extraData: Term?)

The type error occurs when something is not of Expected type

Parameters

Name Description
message: String?

the detail message string.

cause: Throwable?

the cause of this exception.

context: ExecutionContext

The current context at exception creation

expectedType: Expected

The type expected, that wouldn't have raised the error

actualValue: Term

The value not respecting expectedType

extraData: Term?

The possible extra data to be carried with the error

CompanionObject

TypeError

class TypeError: PrologError

The type error occurs when something is not of Expected type

Fields

Name Description
const typeFunctor: String

The type error Struct functor

Methods

forArgument

fun forArgument(context: ExecutionContext, procedure: Signature, expectedType: Expected, actualValue: Term, index: Int?): TypeError

Parameters

Name Description
context: ExecutionContext
procedure: Signature
expectedType: Expected
actualValue: Term
index: Int?

ReturnValue

Name Description
TypeError

forGoal

fun forGoal(context: ExecutionContext, procedure: Signature, expectedType: Expected, actualValue: Term): actualValue` of ${procedure.toIndicator()} is not a $expectedType term".let { TypeError( message = it, context = context, expectedType = expectedType, actualValue = actualValue, extraData = Atom.of(it) ) }

Parameters

Name Description
context: ExecutionContext
procedure: Signature
expectedType: Expected
actualValue: Term

ReturnValue

Name Description
actualValue` of ${procedure.toIndicator()} is not a $expectedType term".let { TypeError( message = it, context = context, expectedType = expectedType, actualValue = actualValue, extraData = Atom.of(it) ) }