Package com.metaobjects.generator
Class GeneratorException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.metaobjects.MetaDataException
com.metaobjects.generator.GeneratorException
- All Implemented Interfaces:
Serializable
public class GeneratorException
extends com.metaobjects.MetaDataException
Exception thrown when code generation operations fail.
Enhanced with structured error reporting capabilities for code generation context.
- Since:
- 1.0 (enhanced in 5.2.0)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGeneratorException(String msg) Creates a GeneratorException with a message.GeneratorException(String message, com.metaobjects.MetaData source, String operation) Creates a GeneratorException with enhanced context information.GeneratorException(String message, com.metaobjects.MetaData source, String operation, Throwable cause, Map<String, Object> additionalContext) Creates a GeneratorException with full context information.GeneratorException(String msg, Exception e) Creates a GeneratorException with a message and cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic GeneratorExceptionforCodeGeneration(String generatorType, String targetFile, com.metaobjects.MetaData source, Throwable cause) Factory method for creating a code generation exception.static GeneratorExceptionforConfiguration(String configProperty, Object configValue, String issue, com.metaobjects.MetaData source) Factory method for creating a configuration exception.static GeneratorExceptionforDependency(String dependencyType, String dependencyName, com.metaobjects.MetaData source) Factory method for creating a dependency resolution exception.static GeneratorExceptionforFileSystem(String fileOperation, String filePath, com.metaobjects.MetaData source, Throwable cause) Factory method for creating a file system exception.static GeneratorExceptionFactory method for creating a syntax error exception.static GeneratorExceptionforTemplate(String templateName, com.metaobjects.MetaData source, Throwable cause) Factory method for creating a template processing exception with enhanced error reporting.static GeneratorExceptionforValidation(Map<String, String> validationErrors, com.metaobjects.MetaData source) Factory method for creating a validation exception during generation.Methods inherited from class com.metaobjects.MetaDataException
getContext, getContextValue, getMetaDataPath, getOperation, getThreadName, getTimestamp, hasEnhancedContextMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GeneratorException
Creates a GeneratorException with a message. Backward compatible constructor.- Parameters:
msg- the error message
-
GeneratorException
Creates a GeneratorException with a message and cause. Backward compatible constructor.- Parameters:
msg- the error messagee- the underlying exception
-
GeneratorException
Creates a GeneratorException with enhanced context information.- Parameters:
message- the error messagesource- the MetaData object providing context (e.g., MetaObject being generated)operation- the generation operation being performed when the error occurred
-
GeneratorException
public GeneratorException(String message, com.metaobjects.MetaData source, String operation, Throwable cause, Map<String, Object> additionalContext) Creates a GeneratorException with full context information.- Parameters:
message- the error messagesource- the MetaData object providing contextoperation- the generation operation being performedcause- the underlying cause (may be null)additionalContext- additional context information (may be empty)
-
-
Method Details
-
forTemplate
public static GeneratorException forTemplate(String templateName, com.metaobjects.MetaData source, Throwable cause) Factory method for creating a template processing exception with enhanced error reporting.- Parameters:
templateName- the name of the template that failed to processsource- the MetaData object providing contextcause- the underlying cause- Returns:
- a configured GeneratorException
-
forCodeGeneration
public static GeneratorException forCodeGeneration(String generatorType, String targetFile, com.metaobjects.MetaData source, Throwable cause) Factory method for creating a code generation exception.- Parameters:
generatorType- the type of generator that failedtargetFile- the target file being generatedsource- the MetaData object providing contextcause- the underlying cause- Returns:
- a configured GeneratorException
-
forConfiguration
public static GeneratorException forConfiguration(String configProperty, Object configValue, String issue, com.metaobjects.MetaData source) Factory method for creating a configuration exception.- Parameters:
configProperty- the configuration property that has an issueconfigValue- the problematic configuration valuesource- the MetaData object providing context- Returns:
- a configured GeneratorException
-
forValidation
public static GeneratorException forValidation(Map<String, String> validationErrors, com.metaobjects.MetaData source) Factory method for creating a validation exception during generation.- Parameters:
validationErrors- the validation errors that occurredsource- the MetaData object providing context- Returns:
- a configured GeneratorException
-
forDependency
public static GeneratorException forDependency(String dependencyType, String dependencyName, com.metaobjects.MetaData source) Factory method for creating a dependency resolution exception.- Parameters:
dependencyType- the type of dependency that could not be resolveddependencyName- the name of the dependencysource- the MetaData object providing context- Returns:
- a configured GeneratorException
-
forSyntax
public static GeneratorException forSyntax(String syntaxError, String fileName, int lineNumber, com.metaobjects.MetaData source) Factory method for creating a syntax error exception.- Parameters:
syntaxError- the syntax error descriptionfileName- the file where the syntax error occurredlineNumber- the line number where the error occurredsource- the MetaData object providing context- Returns:
- a configured GeneratorException
-
forFileSystem
public static GeneratorException forFileSystem(String fileOperation, String filePath, com.metaobjects.MetaData source, Throwable cause) Factory method for creating a file system exception.- Parameters:
fileOperation- the file operation that failedfilePath- the path of the file involvedsource- the MetaData object providing contextcause- the underlying I/O cause- Returns:
- a configured GeneratorException
-