emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/osm c05aa2cb0a 2/2: osm--fetch-json: Improve error mess


From: ELPA Syncer
Subject: [elpa] externals/osm c05aa2cb0a 2/2: osm--fetch-json: Improve error message if fetching fails
Date: Sun, 19 Nov 2023 03:58:15 -0500 (EST)

branch: externals/osm
commit c05aa2cb0ad57bde4e4048239328689b7123ec00
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    osm--fetch-json: Improve error message if fetching fails
---
 osm.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/osm.el b/osm.el
index a09991be6b..5b564a54a2 100644
--- a/osm.el
+++ b/osm.el
@@ -1443,14 +1443,14 @@ When called interactively, call the function 
`osm-home'."
 (defun osm--fetch-json (url)
   "Get json from URL."
   (osm--check-libraries)
-  (json-parse-string
-   (let ((default-process-coding-system '(utf-8-unix . utf-8-unix)))
-     (shell-command-to-string
-      (concat
-       "curl " osm-curl-options " "
-       (shell-quote-argument url))))
-   :array-type 'list
-   :object-type 'alist))
+  (with-temp-buffer
+    (let* ((default-process-coding-system '(utf-8-unix . utf-8-unix))
+           (status (apply #'call-process "curl" nil (current-buffer) nil
+                          `(,@(split-string-and-unquote osm-curl-options) 
,url))))
+      (unless (eq status 0)
+        (error "Fetching %s exited with status %s" url status)))
+    (goto-char (point-min))
+    (json-parse-buffer :array-type 'list :object-type 'alist)))
 
 (defun osm--search (needle)
   "Globally search for NEEDLE and return the list of results."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]