diff options
author | Yoni Rabkin <yonirabkin@member.fsf.org> | 2014-02-23 13:40:45 -0500 |
---|---|---|
committer | Yoni Rabkin <yonirabkin@member.fsf.org> | 2014-02-23 13:40:45 -0500 |
commit | 246acd2c960c57a678640aaf5ce6993b72b2e67a (patch) | |
tree | dd9f2a2ee99492e7d4f5559bb6dc114ac539d9b7 | |
parent | e7725492020d63faaca6fe4593afdb07cb664e42 (diff) |
* rt-liberation.el: Attempt to handle server response when assigning.
-rw-r--r-- | rt-liberation.el | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/rt-liberation.el b/rt-liberation.el index 1ff4389..995a767 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -1202,14 +1202,28 @@ If FIELD already exists, update to VALUE." (rt-liber-command-set-status id (rt-liber-command-get-status-string 'open))) +;; This is brittle because the server doesn't respond with a code but +;; with some free text, and we have no guarantee that the text will be +;; stable from version to version. +(defun rt-liber-handle-response-set-owner (response) + "Handle the response from the RT server. Pass on the response." + (when + (with-temp-buffer + (insert response) + (goto-char (point-min)) + (re-search-forward "That user does not exist" (point-max) t)) + (error "that user does not exist")) + response) + (defun rt-liber-command-set-owner (id owner) "Set the owner of ticket ID to OWNER." (let ((command (rt-liber-command-get-command-string 'edit)) (args (format "ticket/%s set owner=%s" id owner))) - (rt-liber-parse-answer - (rt-liber-command-runner command args) - 'rt-liber-command-runner-parser-f))) + (rt-liber-handle-response-set-owner + (rt-liber-parse-answer + (rt-liber-command-runner command args) + 'rt-liber-command-runner-parser-f)))) (defun rt-liber-command-set-queue (id queue) "Set the queue of ticket ID to QUEUE." |