mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-23 00:34:27 +01:00
Add another hook point to check HISHTORY_SIMULATE_NETWORK_ERROR so that it also blocks downloading updates
This commit is contained in:
parent
9433bd6e94
commit
fdbe91246e
@ -251,6 +251,11 @@ func getTmpClientPath() string {
|
||||
}
|
||||
|
||||
func downloadFile(filename, url string) error {
|
||||
// Support simulating network errors for the purposes of testing
|
||||
if os.Getenv("HISHTORY_SIMULATE_NETWORK_ERROR") != "" {
|
||||
return fmt.Errorf("simulated network error: dial tcp: lookup api.hishtory.dev")
|
||||
}
|
||||
|
||||
// Download the data
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user