MissingRequiredEnvironmentException constructor

MissingRequiredEnvironmentException(
  1. String message, {
  2. Object? cause,
})

Exception thrown when a required environment variable is not found.

This is typically used in systems where environment variables are mandatory and their absence should fail-fast during startup or runtime.

You can optionally attach a cause for additional context.


📦 Example Usage:

final env = Environment.SYSTEM;
try {
  final token = env.get('API_TOKEN');
} on MissingRequiredEnvironmentException catch (e) {
  print('Missing variable: ${e.message}');
}

Used internally by SystemEnvironment.get in the JetLeaf framework.

Creates a new MissingRequiredEnvironmentException with the given message and an optional cause.

Implementation

MissingRequiredEnvironmentException(super.message, {super.cause});