Class GeneratorIOException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.metaobjects.io.MetaDataIOException
com.metaobjects.generator.GeneratorIOException
All Implemented Interfaces:
Serializable

public class GeneratorIOException extends com.metaobjects.io.MetaDataIOException
Exception thrown when I/O operations fail during code generation. Enhanced with structured error reporting capabilities for generation I/O context.
Since:
1.0 (enhanced in 5.2.0)
See Also:
  • Constructor Details

    • GeneratorIOException

      public GeneratorIOException(GeneratorIOWriter writer, String msg)
      Creates a GeneratorIOException with a writer and message. Backward compatible constructor.
      Parameters:
      writer - the generator I/O writer involved
      msg - the error message
    • GeneratorIOException

      public GeneratorIOException(GeneratorIOWriter writer, String msg, Exception e)
      Creates a GeneratorIOException with a writer, message, and cause. Backward compatible constructor.
      Parameters:
      writer - the generator I/O writer involved
      msg - the error message
      e - the underlying exception
    • GeneratorIOException

      public GeneratorIOException(GeneratorIOWriter writer, String message, com.metaobjects.MetaData source, String operation, Map<String,Object> additionalContext)
      Creates a GeneratorIOException with enhanced context information.
      Parameters:
      writer - the generator I/O writer involved
      message - the error message
      source - the MetaData object providing context
      operation - the I/O operation being performed
      additionalContext - additional context information
  • Method Details

    • forFileWrite

      public static GeneratorIOException forFileWrite(GeneratorIOWriter writer, String fileName, com.metaobjects.MetaData source, Exception cause)
      Factory method for creating a file write exception with enhanced error reporting.
      Parameters:
      writer - the generator I/O writer involved
      fileName - the name of the file that failed to write
      source - the MetaData object providing context
      cause - the underlying I/O cause
      Returns:
      a configured GeneratorIOException
    • forTemplateRead

      public static GeneratorIOException forTemplateRead(GeneratorIOWriter writer, String templatePath, com.metaobjects.MetaData source, Exception cause)
      Factory method for creating a template read exception.
      Parameters:
      writer - the generator I/O writer involved
      templatePath - the path of the template that failed to read
      source - the MetaData object providing context
      cause - the underlying I/O cause
      Returns:
      a configured GeneratorIOException
    • forDirectoryCreation

      public static GeneratorIOException forDirectoryCreation(GeneratorIOWriter writer, String directoryPath, com.metaobjects.MetaData source, Exception cause)
      Factory method for creating a directory creation exception.
      Parameters:
      writer - the generator I/O writer involved
      directoryPath - the path of the directory that failed to create
      source - the MetaData object providing context
      cause - the underlying I/O cause
      Returns:
      a configured GeneratorIOException
    • getGeneratorWriter

      public GeneratorIOWriter getGeneratorWriter()
      Returns the generator I/O writer associated with this exception.
      Returns:
      the generator I/O writer
    • getContext

      public Map<String,Object> getContext()
      Returns the context information associated with this error.
      Returns:
      unmodifiable map of context information
    • getContextValue

      public Object getContextValue(String key)
      Returns a specific context value by key.
      Parameters:
      key - the context key
      Returns:
      the value, or null if not found
    • hasEnhancedContext

      public boolean hasEnhancedContext()
      Checks if this exception has enhanced context information.
      Returns:
      true if this exception has additional context beyond the basic message