FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Better wasm http timeout error message by ianthomas23 · Pull Request #190 · QuantStack/git2cpp · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (1) .py  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 8 additions & 2 deletions src/wasm/stream.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

# include "stream.hpp"

# include <cstdlib>
# include <regex>
# include <sstream>
# include <string>

# include <emscripten.h>

Expand Down Expand Up @@ -283,12 +285,16 @@ static void convert_js_to_git_error(wasm_http_stream* stream)
}
else if (std::string_view(error_str).starts_with("TimeoutError:"))
{
auto env_var = std::getenv(WASM_HTTP_TRANSPORT_TIMEOUT_NAME.data());
std::string value = env_var != nullptr ? env_var
: std::to_string(WASM_HTTP_TRANSPORT_TIMEOUT_DEFAULT_S);
git_error_set(
GIT_ERROR_HTTP,
"network request timed out connecting to %s. You can set a longer timeout in seconds using the environment variable %s, the default value is %u seconds.",
"network request timed out connecting to %s. You can set a longer timeout in seconds using the environment variable %s, the %s value is %s seconds.",
stream->m_unconverted_url.c_str(),
WASM_HTTP_TRANSPORT_TIMEOUT_NAME.data(),
WASM_HTTP_TRANSPORT_TIMEOUT_DEFAULT_S
env_var != nullptr ? "current" : "default",
value.c_str()
);
}
else
Expand Down
1 change: 1 addition & 0 deletions test/test_clone.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def test_clone_timeout(git2cpp_path, tmp_path, run_in_tmp_path):
"set a longer timeout in seconds using the environment variable GIT_HTTP_TIMEOUT"
in p_clone.stderr
)
assert "the current value is 0.001 seconds" in p_clone.stderr

# Set more reasonable timeout.
subprocess.run(["export", "GIT_HTTP_TIMEOUT=10"], check=True)
Expand Down
Loading

Back | FazBrowse Home | New Git URL