Skip to content

enhanced error handling for open weather API errors#192

Closed
anveshthakur wants to merge 23 commits intoschachmat:masterfrom
anveshthakur:feat/api-errors
Closed

enhanced error handling for open weather API errors#192
anveshthakur wants to merge 23 commits intoschachmat:masterfrom
anveshthakur:feat/api-errors

Conversation

@anveshthakur
Copy link
Copy Markdown
Contributor

@anveshthakur anveshthakur commented Sep 28, 2024

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 Code as a string value for some of cases but if there is an invalid API key they send Code 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
Copy Markdown
Contributor Author

anveshthakur commented Sep 28, 2024

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

peter81git and others added 3 commits October 6, 2024 18:42
Bug fix for issue schachmat#170

Co-authored-by: Pedro Pereira <pedro.1.pereira@nokia.com>
Current openweather api usage does not have daily astronomy. Api "onecall" seems to have.

Co-authored-by: Pedro Pereira <pedro.1.pereira@nokia.com>
compacts the table and hides cloud icons
anveshthakur and others added 13 commits October 7, 2024 00:09
Bumps [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable) from 0.1.13 to 0.1.14.
- [Commits](mattn/go-colorable@v0.1.13...v0.1.14)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-colorable
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Agent-Logs-Url: https://github.com/schachmat/wego/sessions/e7020400-10d3-4119-8c62-9806e4de0ef2

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
* Add explicit import aliases for go-runewidth and go-colorable

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/0c63b2e2-efeb-44a9-a918-f4e769258361

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Fix all golangci-lint issues across frontends and backends

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/0c63b2e2-efeb-44a9-a918-f4e769258361

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Update golangci-lint version to v1.64 for Go 1.22+ compatibility

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/2043283b-a184-4384-8ee7-6a89926c0b1d

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Update golangci-lint to v2.11.4 to fix Go 1.26 stdlib typecheck error

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/de01a58a-38b0-4e37-9ac5-b4518d017a90

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Upgrade golangci-lint-action to version 7

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
Co-authored-by: Kordian Bruck <kordianbruck@users.noreply.github.com>
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 9.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@v6...v9)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/mattn/go-runewidth](https://github.com/mattn/go-runewidth) from 0.0.16 to 0.0.20.
- [Commits](mattn/go-runewidth@v0.0.16...v0.0.20)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-runewidth
  dependency-version: 0.0.20
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5 to 6.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The endpoints as of 2026-04-04 appear to be:

free/v2 => premium/v1 (still free)

documented here https://github.com/WorldWeatherOnline/weather-api-docs

also, move the debug request print to where it will actually happen on
request fail
Co-authored-by: 0x0003 <0x0003@users.noreply.github.com>
* Initial plan

* Add man page generation via mango with --man flag

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/00705e77-602c-4b73-9fda-139ce74cce3a

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
…mat#223)

* Initial plan

* Implement disk-based JSON caching in /tmp to reduce API calls

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/685ebab8-b98c-481c-9089-79312dba6748

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
@kordianbruck
Copy link
Copy Markdown
Collaborator

Could you rebase this PR please?

Copilot AI and others added 2 commits April 11, 2026 23:23
* Add weatherapi.com backend and update README

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/823f57c2-2b5e-4347-962b-f80083b3332d

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Fix API key exposure in error/debug log messages

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/823f57c2-2b5e-4347-962b-f80083b3332d

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Fix CodeQL taint: build safe URL without using apiKey

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/823f57c2-2b5e-4347-962b-f80083b3332d

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Remove redundant parentheses in address-of expressions

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/823f57c2-2b5e-4347-962b-f80083b3332d

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

* Fix lint issues: lowercase error strings and check Body.Close error

Agent-Logs-Url: https://github.com/schachmat/wego/sessions/505f0e3a-aa82-4117-b571-e1309ed9dcf8

Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
@anveshthakur
Copy link
Copy Markdown
Contributor Author

Could you rebase this PR please?

sure.

@kordianbruck
Copy link
Copy Markdown
Collaborator

Something really went wrong in that merge resolve/rebase.

@anveshthakur
Copy link
Copy Markdown
Contributor Author

Something really went wrong in that merge resolve/rebase.

checking.

@anveshthakur
Copy link
Copy Markdown
Contributor Author

Something really went wrong in that merge resolve/rebase.

Hey @kordianbruck, Let me create a fresh PR for this.
This is all messed up.

#227

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.

7 participants