Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add exception handling for empty or corrupt .env file #215

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

abhinavs1920
Copy link

Pull Request

Title

fix: add exception handling for empty or corrupt .env file

Description

This PR addresses the issue of unhandled exceptions when loading environment variables from a .env file. The application previously crashed when encountering issues such as an empty file, incorrect UTF encoding, malformed content, or a missing file. This change introduces exception handling to gracefully manage these scenarios, providing meaningful error messages and preventing application crashes.

Fixes # (issue number)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

The changes have been tested by simulating various .env file issues:

  1. An empty .env file
  2. Incorrect UTF encoding
  3. Malformed content
  4. Missing .env file

The application was run in each scenario to ensure that it no longer crashes and that appropriate error messages are logged.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

fix: add exception handling for empty or corrupt .env file
fix: add exception handling for empty or corrupt .env file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty env file exception unhandled
1 participant