Package com.tnsai.exceptions
Class KnowledgeNotReadyException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.tnsai.exceptions.TnsAIException
com.tnsai.exceptions.ValidationException
com.tnsai.exceptions.KnowledgeNotReadyException
- All Implemented Interfaces:
Serializable
Thrown when a configured
WHEN_CONFIGURED source is not ready before a run: its file is missing, it
holds no unit, or it cannot be read.
The message names the host class and the source, not the file path or
the target. An exception created for a target carries it in
target(), so a host can name the target in its own refusal.
- Since:
- 0.18.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhy a source is not ready. -
Constructor Summary
ConstructorsConstructorDescriptionKnowledgeNotReadyException(Class<?> host, String source, KnowledgeNotReadyException.Problem problem) Creates the exception.KnowledgeNotReadyException(Class<?> host, String source, KnowledgeNotReadyException.Problem problem, Throwable cause) Creates the exception with a cause.KnowledgeNotReadyException(Object target, String source, KnowledgeNotReadyException.Problem problem) Creates the exception for a checked target, whose class is the host.KnowledgeNotReadyException(Object target, String source, KnowledgeNotReadyException.Problem problem, Throwable cause) Creates the exception for a checked target with a cause. -
Method Summary
Methods inherited from class com.tnsai.exceptions.TnsAIException
getContext, getErrorCode, getMaxRetryAttempts, getMessage, getSuggestedRetryDelayMs, getThrownAt, isRetryable, wrapMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
KnowledgeNotReadyException
public KnowledgeNotReadyException(Class<?> host, String source, KnowledgeNotReadyException.Problem problem) Creates the exception.- Parameters:
host- the class whose knowledge declares the sourcesource- the source nameproblem- why the source is not ready
-
KnowledgeNotReadyException
public KnowledgeNotReadyException(Class<?> host, String source, KnowledgeNotReadyException.Problem problem, Throwable cause) Creates the exception with a cause.- Parameters:
host- the class whose knowledge declares the sourcesource- the source nameproblem- why the source is not readycause- the underlying failure, ornull
-
KnowledgeNotReadyException
public KnowledgeNotReadyException(Object target, String source, KnowledgeNotReadyException.Problem problem) Creates the exception for a checked target, whose class is the host.- Parameters:
target- the instance whose knowledge was checkedsource- the source nameproblem- why the source is not ready
-
KnowledgeNotReadyException
public KnowledgeNotReadyException(Object target, String source, KnowledgeNotReadyException.Problem problem, Throwable cause) Creates the exception for a checked target with a cause.- Parameters:
target- the instance whose knowledge was checkedsource- the source nameproblem- why the source is not readycause- the underlying failure, ornull
-
-
Method Details
-
host
Returns the class whose knowledge declares the source.- Returns:
- the host class
-
source
Returns the source name.- Returns:
- the source name
-
problem
Returns why the source is not ready.- Returns:
- the problem
-
target
Returns the instance whose knowledge was checked. The field is transient: it isnullafter deserialization, and for an exception created from a host class.- Returns:
- the checked target, or
null
-