consistency_error/3 — Logtalk 3.100.1

built-in method

# `consistency_error/3`

## Description

    consistency_error(Consistency, Argument1, Argument2)

Throws a consistency error. Used when two directives or predicate arguments are individually correct but together are not consistent. For example, a predicate and its alias having different arity in a `uses/2` directive. This built-in method is declared private and thus cannot be used as a message to an object. Calling this predicate is equivalent to the following sequence of goals:

    ...,
    context(Context),
    throw(error(consistency_error(Consistency,Argument1,Argument2), Context)).

This allows the user to generate errors in the same format used by the runtime.

Possible values representing `Consistency` checks include:

- `same_arity`

- `same_number_of_parameters`

- `same_number_of_arguments`

- `same_closure_specification`

## Modes and number of proofs

    consistency_error(+atom, @nonvar, @nonvar) - error

## Errors

When called:
`consistency_error(Consistency, Argument1, Argument2)`

## Examples

    % code that will trigger consistency errors when compiled:

    % predicates (and non-terminals) aliases must have the same
    % arity as the original predicates (and non-terminals)
    :- uses(list, [
        member/2 as in/1
    ]).

    % meta-predicate templates should be consistent with how closures
    % are used regarding the number of additional arguments
    :- public(p/2).
    :- meta_predicate(p(1, *)).

    p(G, A) :-
        call(G, A, 2).

See also

catch/3, throw/1, context/1, instantiation_error/0, uninstantiation_error/1, type_error/2, domain_error/2, existence_error/2, permission_error/3, representation_error/1, evaluation_error/1, resource_error/1, syntax_error/1, system_error/0