diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-04 16:32:16 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-04 16:32:16 -0500 |
| commit | 73c81a00a10766900318d86640249d1b54c6b351 (patch) | |
| tree | 793f9c858060591c34813af05e84c7a6a5442153 /tests/test-wttrin--fetch-url.el | |
| parent | a77a7b86f45ae96ff1802ea6f8b87dafd46b17b0 (diff) | |
| download | emacs-wttrin-73c81a00a10766900318d86640249d1b54c6b351.tar.gz emacs-wttrin-73c81a00a10766900318d86640249d1b54c6b351.zip | |
feat: specific error messages for fetch failures
Add HTTP status code checking (wttrin--extract-http-status) and pass
error descriptions through the callback chain so users see "Location
not found (HTTP 404)" or "Network error — check your connection"
instead of the generic "Perhaps the location was misspelled?" for
every failure.
Also fix pre-existing bug where the condition-case error handler in
extract-response-body killed an unrelated buffer after unwind-protect
already cleaned up.
330 tests (was 307), all passing.
Diffstat (limited to 'tests/test-wttrin--fetch-url.el')
| -rw-r--r-- | tests/test-wttrin--fetch-url.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/test-wttrin--fetch-url.el b/tests/test-wttrin--fetch-url.el index 9a2e58b..4bb02d7 100644 --- a/tests/test-wttrin--fetch-url.el +++ b/tests/test-wttrin--fetch-url.el @@ -41,7 +41,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-called t) (setq callback-data data))) @@ -61,7 +61,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-data data))) (should (string-match-p "☀️" callback-data)) @@ -82,7 +82,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-data data))) ;; Headers should not be in the data @@ -104,7 +104,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-data data))) (should (string= "" callback-data))))) @@ -122,7 +122,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-data data))) (should (= 10000 (length callback-data)))))) @@ -141,7 +141,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-data data))) (should (string= "Weather data" callback-data))))) @@ -160,7 +160,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-called t) (setq callback-data data))) @@ -180,7 +180,7 @@ (wttrin--fetch-url "http://example.com/weather" - (lambda (data) + (lambda (data &optional _error-msg) (setq callback-called t))) (should callback-called) |
