[PR #12330] [MERGED] tools.func: Improve GitHub/Codeberg API error handling and error output #10141

Closed
opened 2026-02-26 17:33:10 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/12330
Author: @MickLesk
Created: 2/25/2026
Status: Merged
Merged: 2/25/2026
Merged by: @tremor021

Base: mainHead: fix/github-api-error-messages


📝 Commits (2)

  • 375dcca tools.func: Improve GitHub/Codeberg API error handling and error output
  • 4e52111 switch returns

📊 Changes

1 file changed (+106 additions, -17 deletions)

View changed files

📝 misc/tools.func (+106 -17)

📄 Description

✍️ Description

Enhance API call robustness and user feedback:

  • add explicit handling for HTTP 401 (authentication) and 000/no-response cases
  • provide clearer error messages and actionable guidance (e.g. export GITHUB_TOKEN, check network/DNS)
  • preserve retry/backoff logic.

Adjusted curl invocation/error capture to avoid echoing sentinel values and updated messages for 403/404/other HTTP errors. Changes touch github_api_call, codeberg_api_call, get_latest_gh_tag, check_for_gh_release, and fetch_and_deploy_gh_release to fail earlier and clean up temp files on errors.

before:

✖️ GitHub API call failed with HTTP 401000          ← wrong Code (concat bug)
✖️ in line 31: exit code 1 ... return 1             ← error_handler Noise
✖️ in line 31: exit code 1 ... VAULT=$(get_latest)  ← again Noise

new:

✖️ GitHub API authentication failed (HTTP 401).
✖️ Your GITHUB_TOKEN appears to be invalid or expired.

Fixes #12312

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/12330 **Author:** [@MickLesk](https://github.com/MickLesk) **Created:** 2/25/2026 **Status:** ✅ Merged **Merged:** 2/25/2026 **Merged by:** [@tremor021](https://github.com/tremor021) **Base:** `main` ← **Head:** `fix/github-api-error-messages` --- ### 📝 Commits (2) - [`375dcca`](https://github.com/community-scripts/ProxmoxVE/commit/375dccacb1e7d731d80d779a454cc4f68e108280) tools.func: Improve GitHub/Codeberg API error handling and error output - [`4e52111`](https://github.com/community-scripts/ProxmoxVE/commit/4e52111ca04e3fc4a48c65f035a24eac0a0727b3) switch returns ### 📊 Changes **1 file changed** (+106 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `misc/tools.func` (+106 -17) </details> ### 📄 Description <!--🛑 New scripts must be submitted to [ProxmoxVED](https://github.com/community-scripts/ProxmoxVED) for testing. PRs without prior testing will be closed. --> ## ✍️ Description Enhance API call robustness and user feedback: - add explicit handling for HTTP 401 (authentication) and 000/no-response cases - provide clearer error messages and actionable guidance (e.g. export GITHUB_TOKEN, check network/DNS) - preserve retry/backoff logic. Adjusted curl invocation/error capture to avoid echoing sentinel values and updated messages for 403/404/other HTTP errors. Changes touch github_api_call, codeberg_api_call, get_latest_gh_tag, check_for_gh_release, and fetch_and_deploy_gh_release to fail earlier and clean up temp files on errors. before: ```bash ✖️ GitHub API call failed with HTTP 401000 ← wrong Code (concat bug) ✖️ in line 31: exit code 1 ... return 1 ← error_handler Noise ✖️ in line 31: exit code 1 ... VAULT=$(get_latest) ← again Noise ``` new: ```bash ✖️ GitHub API authentication failed (HTTP 401). ✖️ Your GITHUB_TOKEN appears to be invalid or expired. ``` ## 🔗 Related Issue Fixes #12312 ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [x] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [ ] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 17:33:10 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#10141
No description provided.