aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx-request.el22
-rw-r--r--sx.el5
2 files changed, 15 insertions, 12 deletions
diff --git a/sx-request.el b/sx-request.el
index f987d2c..4e2ba5c 100644
--- a/sx-request.el
+++ b/sx-request.el
@@ -112,18 +112,16 @@ number of requests left every time it finishes a call.")
(sx-message "Unable to parse response: %S" response)
(error "Response could not be read by `json-read-from-string'")))
;; If we get here, the response is a valid data structure
- (when (assoc 'error_id response)
- (error "Request failed: (%s) [%i %s] %S"
- method
- (cdr (assoc 'error_id response))
- (cdr (assoc 'error_name response))
- (cdr (assoc 'error_message response))))
- (when (< (setq sx-request-remaining-api-requests
- (cdr (assoc 'quota_remaining response)))
- sx-request-remaining-api-requests-message-threshold)
- (sx-message "%d API requests reamining"
- sx-request-remaining-api-requests))
- (cdr (assoc 'items response))))))))
+ (sx-assoc-let response
+ (when error_id
+ (error "Request failed: (%s) [%i %s] %S"
+ method error_id error_name error_message))
+ (when (< (setq sx-request-remaining-api-requests
+ quota_remaining)
+ sx-request-remaining-api-requests-message-threshold)
+ (sx-message "%d API requests reamining"
+ sx-request-remaining-api-requests))
+ items)))))))
;;; Support Functions
diff --git a/sx.el b/sx.el
index 2f7b6a7..00fda40 100644
--- a/sx.el
+++ b/sx.el
@@ -87,7 +87,11 @@ a string, just return it."
display_name
downvoted
edited
+ error_id
+ error_name
+ error_message
favorite_count
+ items
is_accepted
is_answered
last_activity_date
@@ -97,6 +101,7 @@ a string, just return it."
owner
profile_image
question_id
+ quota_remaining
reopen_vote_count
reputation
score