java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.metaschema.core.metapath.MetapathException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DynamicMetapathException,FunctionMetapathError,RegularExpressionMetapathException,StaticMetapathException,TypeMetapathException
MetapathException is the superclass of all exceptions that can be
thrown during the compilation and evaluation of a Metapath.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetapathException(IErrorCode errorCode, String message) Constructs a new Metapath exception with the providedcodeandmessageand no cause.protectedMetapathException(IErrorCode errorCode, String message, Throwable cause) Constructs a new Metapath exception with the providedcode,messageandcause.protectedMetapathException(IErrorCode errorCode, Throwable cause) Constructs a new Metapath exception with anullmessage and the providedcodeandcause. -
Method Summary
Modifier and TypeMethodDescriptionfinal IErrorCodeGet the error code, which indicates what type of error it is.protected Deque<IExpression>Retrieves the evaluation stack recording the expressions being evaluated.final StringGet the message text without the error code prefix.final MetapathExceptionregisterEvaluationContext(DynamicContext dynamicContext) Registers the evaluation context from the provided dynamic context.final MetapathExceptionregisterEvaluationContext(IMetapathExpression metapath) Registers the evaluation context from the provided metapath expression.final MetapathExceptionregisterEvaluationContext(Deque<? extends IExpression> stack) Registers the evaluation context from the provided evaluation stack.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MetapathException
Constructs a new Metapath exception with the providedcodeandmessageand no cause.- Parameters:
errorCode- the error code that identifies the type of errormessage- the exception message
-
MetapathException
Constructs a new Metapath exception with anullmessage and the providedcodeandcause.- Parameters:
errorCode- the error code that identifies the type of errorcause- the exception cause
-
MetapathException
protected MetapathException(@NonNull IErrorCode errorCode, @Nullable String message, @Nullable Throwable cause) Constructs a new Metapath exception with the providedcode,messageandcause.- Parameters:
errorCode- the error code that identifies the type of errormessage- the exception messagecause- the exception cause
-
-
Method Details
-
registerEvaluationContext
Registers the evaluation context from the provided dynamic context.A snapshot of the execution stack is captured from the dynamic context if not already set. This ensures the recorded state reflects the stack at the time of registration, avoiding confusion from post-throw mutations.
- Parameters:
dynamicContext- the dynamic context containing the execution stack- Returns:
- this exception instance for chaining
-
registerEvaluationContext
public final MetapathException registerEvaluationContext(@NonNull Deque<? extends IExpression> stack) Registers the evaluation context from the provided evaluation stack.A snapshot of the stack is captured if not already set.
- Parameters:
stack- the evaluation stack recording the expressions being evaluated- Returns:
- this exception instance for chaining
-
registerEvaluationContext
Registers the evaluation context from the provided metapath expression.The expression is recorded as the evaluation context if not already set.
- Parameters:
metapath- the metapath expression being evaluated- Returns:
- this exception instance for chaining
-
getEvaluationStack
Retrieves the evaluation stack recording the expressions being evaluated.- Returns:
- the evaluation stack, or
nullif not set
-
getMessage
- Overrides:
getMessagein classThrowable
-
getMessageText
Get the message text without the error code prefix.- Returns:
- the message text or
null
-
getErrorCode
Get the error code, which indicates what type of error it is.- Returns:
- the error code
-