Skip to content

Commit f84eaa4

Browse files
committed
feat: improve HTTP error diagnostics with detailed user-facing messages
1 parent f1c05eb commit f84eaa4

3 files changed

Lines changed: 147 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ if(UNIX AND NOT APPLE)
106106

107107
target_compile_options(${PROJECT_NAME} PRIVATE ${GLFW_CFLAGS})
108108
target_link_libraries(${PROJECT_NAME} PRIVATE ${GLFW_LDFLAGS} GL)
109-
110109
elseif(APPLE)
111110
find_library(COCOA_LIBRARY Cocoa REQUIRED)
112111
find_library(IOKIT_LIBRARY IOKit REQUIRED)
@@ -121,7 +120,6 @@ elseif(APPLE)
121120
${OPENGL_LIBRARY}
122121
${GLFW_LIBRARY}
123122
)
124-
125123
elseif(WIN32)
126124
target_include_directories(${PROJECT_NAME}
127125
SYSTEM PRIVATE ${minizip_ng_SOURCE_DIR}

src/include/http.h

Lines changed: 144 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/routes/install_prompt.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,20 @@ const bool FetchVersionInfo()
124124

125125
if (response.isNetworkError()) {
126126
if (page == 1) {
127-
ShowMessageBox("Whoops!", "Failed to connect to the GitHub API! Make sure you have a valid internet connection.", Error);
127+
ShowMessageBox("Whoops!", std::format("Failed to connect to the GitHub API!\n\n{}", response.networkErrorReason()), Error);
128128
return false;
129129
}
130130
break;
131131
}
132132

133133
if (response.isRateLimited()) {
134-
ShowMessageBox("Whoops!", "GitHub API rate limit exceeded. Please wait a few minutes and try again.", Error);
134+
ShowMessageBox("Whoops!", response.rateLimitMessage(), Error);
135135
return false;
136136
}
137137

138138
if (!response.ok()) {
139139
if (page == 1) {
140-
ShowMessageBox("Whoops!", std::format("Failed to fetch version information (HTTP {}). Please try again later.", response.statusCode), Error);
140+
ShowMessageBox("Whoops!", response.httpErrorMessage(), Error);
141141
return false;
142142
}
143143
break;

0 commit comments

Comments
 (0)