permission_error/3
Description
permission_error(Operation, Permission, Culprit)
Throws an permission error. Used when an operation is not allowed. For example, sending a message for a predicate that is not within the scope of the sender. 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(permission_error(Operation,Permission,Culprit), Context)).
This allows the user to generate errors in the same format used by the runtime.
Possible values for Operation include:
accesscreatemodifyopeninputoutputrepositionrepeat
Possible values for Permission include:
predicate_declarationprotected_predicateprivate_predicatestatic_predicatedatabaseobjectstatic_objectstatic_protocolstatic_categoryentity_relationoperatorflagenginebinary_streamtext_streamsource_sinkstreampast_end_of_stream
The value of Culprit is the argument or one of its sub-terms that caused
the error.
Modes and number of proofs
permission_error(@nonvar, @nonvar, @nonvar) - error
Errors
permission_error(Operation, Permission, Culprit)Examples
...,
\+ writable(File),
permission_error(modify, file, File).