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: Return HTTP 404 when file does not exist #393

Merged

Conversation

mahmoud-40
Copy link
Contributor

Pull Request

Description

This PR adds a check to verify whether the requested file exists before attempting to access it. If the file does not exist, the API now returns an HTTP 404 Not Found error instead of failing with an internal server error.

Fixes #392

How Has This Been Tested?

  • Extended existing test cases to cover scenarios where the requested file does not exist.
  • Verified that the new checks do not break existing functionality

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Data processing is not affected, as this change only modifies error handling.

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@peterdudfield peterdudfield merged commit 6337ed4 into openclimatefix:main Feb 7, 2025
1 check passed
@peterdudfield
Copy link
Collaborator

@all-contributors please add @mahmoud-40 for code

Copy link
Contributor

@peterdudfield

I've put up a pull request to add @mahmoud-40! 🎉

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.

if file doesnt exits, return HTTP 404
2 participants