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

enhanced error handling for open weather API errors #192

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

Conversation

anveshthakur
Copy link

Motivation and Context

This change was requested in this issue #176

Description

I've handled error and success case that is coming from open weather API where I am checking the response code from the API and then printing it to the terminal, The marshalling was not happening because API sends Cod as a string value for some of cases but if there is an invalid API key they send Cod value is coming as an integer value I've handled this and just checking the type and marshalling it to a new struct called openWeatherErrorResponse

Steps for Testing

To test we can check different API responses like -

  1. Invalidate API key
  2. Invalidate the open weather API
  3. For success case everything should work like it used be.

Screenshots

Invalid API key

image

Invalid API route

image

Success

image

@anveshthakur
Copy link
Author

anveshthakur commented Sep 28, 2024

Hi @kordianbruck, Let me know if any changes are required required. Thanks!

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.

1 participant