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

Added proper error handling when trying to return false templates #765

Merged
merged 6 commits into from
Jan 29, 2025

Conversation

QuentinPace
Copy link
Contributor

What GitHub issue does this PR apply to?

Resolves #764

What changed and why?

Added a try catch block so the end user doesn't get that 500 internal server error, this is good for the future too if a user is trying to access an invalid API url.

Checklist

  • I claimed any associated issue(s) and they are not someone else's
  • I have looked at documentation to ensure I made any revisions correctly
  • I tested my changes locally to ensure they work
  • For language files, I have validated the edited files are valid JSON and data shows up correctly
  • For website code edits, I have added or edited any appropriate unit tests for my changes

Any additional comments or things to be aware of while reviewing?

Happy to help!

@geekygirlsarah
Copy link
Member

geekygirlsarah commented Jan 28, 2025

Such a simple fix that I didn't have time to research yet. Thanks!

(The docker build check fail is a thing that's happened due to something happening with the container and not your code itself.)

Would you mind adding in some unit tests to help spot future issues if this happens again?

@QuentinPace
Copy link
Contributor Author

Of course, One second!

@geekygirlsarah
Copy link
Member

should i worry about the "Check Docker Build" check failing at the moment?

I didn't edit my last comment fast enough! No, it's a result of something to do with how the Docker container processes the PIP installs, so it's not your fault. I'll merge regardless of that check (and why it's optional right now.)

@QuentinPace
Copy link
Contributor Author

Alright just pushed test coverage!

@geekygirlsarah
Copy link
Member

Thanks! One second tiny ask (sorry!)... You test for failure, can you test for success?

@QuentinPace
Copy link
Contributor Author

No problem, and It looks like There is already a test case for the succesful response.
Screenshot 2025-01-28 122029

@QuentinPace
Copy link
Contributor Author

If you would like more test cases on this one I can do that for you!

web/views.py Outdated Show resolved Hide resolved
Copy link
Member

@geekygirlsarah geekygirlsarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this and making the tweaks. I'll merge it in.

Have a great rest of the week!

@geekygirlsarah
Copy link
Member

Oh and for being a first-time contributor too! Congrats!

@geekygirlsarah geekygirlsarah merged commit fe62247 into codethesaurus:main Jan 29, 2025
4 of 5 checks passed
@QuentinPace
Copy link
Contributor Author

Thank you, you have a good one as well!

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.

[Bug] 500 server error on invalid API requests
2 participants