Class EnvContextLoaderException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.sysr.springcontext.env.exception.EnvContextLoaderException
All Implemented Interfaces:
Serializable

public class EnvContextLoaderException extends RuntimeException
Exception thrown when there is an error loading the environment variables from a dotenv file in a Spring application. This exception extends RuntimeException, indicating it is a unchecked exception that can occur during the normal operation of the application, particularly during environment setup or context loading.

Using this exception helps to pinpoint issues related to the application context not being properly configured due to missing or misconfigured environment variables.

Example usage:

 try {
     // Some code
 } catch (IOException e) {
     throw new EnvContextLoaderException("Failed to load environment variables", e);
 }
 
Since:
2024
See Also:
  • Constructor Details

    • EnvContextLoaderException

      public EnvContextLoaderException(String message)
      Constructs a new EnvContextLoaderException with the specified detail message.
      Parameters:
      message - the detail message, saved for later retrieval by the Throwable.getMessage() method.
    • EnvContextLoaderException

      public EnvContextLoaderException(String message, Throwable cause)
      Constructs a new EnvContextLoaderException with the specified detail message and cause.
      Parameters:
      message - the detail message explaining the reason for the exception, saved for later retrieval by the Throwable.getMessage() method.
      cause - the underlying cause of the exception, saved for later retrieval by the Throwable.getCause() method.