Package com.metaobjects.generator
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 Summary
ConstructorsConstructorDescriptionGeneratorIOException(GeneratorIOWriter writer, String msg) Creates a GeneratorIOException with a writer and message.GeneratorIOException(GeneratorIOWriter writer, String message, com.metaobjects.MetaData source, String operation, Map<String, Object> additionalContext) Creates a GeneratorIOException with enhanced context information.GeneratorIOException(GeneratorIOWriter writer, String msg, Exception e) Creates a GeneratorIOException with a writer, message, and cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic GeneratorIOExceptionforDirectoryCreation(GeneratorIOWriter writer, String directoryPath, com.metaobjects.MetaData source, Exception cause) Factory method for creating a directory creation exception.static GeneratorIOExceptionforFileWrite(GeneratorIOWriter writer, String fileName, com.metaobjects.MetaData source, Exception cause) Factory method for creating a file write exception with enhanced error reporting.static GeneratorIOExceptionforTemplateRead(GeneratorIOWriter writer, String templatePath, com.metaobjects.MetaData source, Exception cause) Factory method for creating a template read exception.Returns the context information associated with this error.getContextValue(String key) Returns a specific context value by key.Returns the generator I/O writer associated with this exception.booleanChecks if this exception has enhanced context information.Methods inherited from class com.metaobjects.io.MetaDataIOException
getPrefixMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GeneratorIOException
Creates a GeneratorIOException with a writer and message. Backward compatible constructor.- Parameters:
writer- the generator I/O writer involvedmsg- the error message
-
GeneratorIOException
Creates a GeneratorIOException with a writer, message, and cause. Backward compatible constructor.- Parameters:
writer- the generator I/O writer involvedmsg- the error messagee- 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 involvedmessage- the error messagesource- the MetaData object providing contextoperation- the I/O operation being performedadditionalContext- 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 involvedfileName- the name of the file that failed to writesource- the MetaData object providing contextcause- 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 involvedtemplatePath- the path of the template that failed to readsource- the MetaData object providing contextcause- 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 involveddirectoryPath- the path of the directory that failed to createsource- the MetaData object providing contextcause- the underlying I/O cause- Returns:
- a configured GeneratorIOException
-
getGeneratorWriter
Returns the generator I/O writer associated with this exception.- Returns:
- the generator I/O writer
-
getContext
Returns the context information associated with this error.- Returns:
- unmodifiable map of context information
-
getContextValue
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
-