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 Details

    • GeneratorException

      public GeneratorException(String msg)
      Creates a GeneratorException with a message. Backward compatible constructor.
      Parameters:
      msg - the error message
    • GeneratorException

      public GeneratorException(String msg, Exception e)
      Creates a GeneratorException with a message and cause. Backward compatible constructor.
      Parameters:
      msg - the error message
      e - the underlying exception
    • GeneratorException

      public GeneratorException(String message, com.metaobjects.MetaData source, String operation)
      Creates a GeneratorException with enhanced context information.
      Parameters:
      message - the error message
      source - 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 message
      source - the MetaData object providing context
      operation - the generation operation being performed
      cause - 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 process
      source - the MetaData object providing context
      cause - 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 failed
      targetFile - the target file being generated
      source - the MetaData object providing context
      cause - 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 issue
      configValue - the problematic configuration value
      source - 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 occurred
      source - 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 resolved
      dependencyName - the name of the dependency
      source - 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 description
      fileName - the file where the syntax error occurred
      lineNumber - the line number where the error occurred
      source - 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 failed
      filePath - the path of the file involved
      source - the MetaData object providing context
      cause - the underlying I/O cause
      Returns:
      a configured GeneratorException