Skip to content

Error Handling

Groundbreaking edited this page Aug 29, 2025 · 1 revision

Error Handling Guide

Exception Types

  • FileReadException - Runtime exception for all I/O errors
  • IllegalStateException - Invalid operations (reset without mark)

Best Practices

try {
    String content = Fission.readString("file.txt");
} catch (FileReadException e) {
    logger.error("Failed to read file", e);
    // Recovery logic
}

// For character sources
try (CharSource source = Fission.chars("file.txt")) {
    // Processing
} // Auto-close even on exception

Common Scenarios

  • File not found → FileReadException
  • Permission denied → FileReadException
  • Invalid mark/reset → IllegalStateException
  • Encoding issues → FileReadException

Clone this wiki locally