GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — improve error handling and logging for GitHub API failures in upgrade… · markathomas/opencode@d6eff3b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • install
  • packages/opencode/src/installation
    • index.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎install‎

Copy file name to clipboardExpand all lines: install
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if [ -z "$requested_version" ]; then
4848
url="https://github.com/sst/opencode/releases/latest/download/$filename"
4949
specific_version=$(curl -s https://api.github.com/repos/sst/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}')
5050

51-
if [[ $? -ne 0 ]]; then
51+
if [[ $? -ne 0 || -z "$specific_version" ]]; then
5252
echo "${RED}Failed to fetch version information${NC}"
5353
exit 1
5454
fi
Collapse file

‎packages/opencode/src/installation/index.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/installation/index.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ export namespace Installation {
140140
export async function latest() {
141141
return fetch("https://api.github.com/repos/sst/opencode/releases/latest")
142142
.then((res) => res.json())
143-
.then((data) => data.tag_name.slice(1) as string)
143+
.then((data) => {
144+
if (typeof data.tag_name !== "string") {
145+
log.error("GitHub API error", data)
146+
throw new Error("failed to fetch latest version")
147+
}
148+
return data.tag_name.slice(1) as string
149+
})
144150
}
145151
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.