aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-10-31 20:00:10 -0400
committerKyle Meyer <kyle@kyleam.com>2016-11-01 21:57:42 -0400
commit13620417f99495f74b17cd2d9ca3c37551dbb120 (patch)
tree27d8d83cc11e5c82b08ab8c613d60702ca7d0246
parent31c284548e00939038a600030119d03f7d63263d (diff)
downloadsnakemake-mode-13620417f99495f74b17cd2d9ca3c37551dbb120.tar.gz
Display unexpected errors from snakemake calls
-rw-r--r--snakemake.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/snakemake.el b/snakemake.el
index fca801e..5baeae1 100644
--- a/snakemake.el
+++ b/snakemake.el
@@ -204,6 +204,18 @@ with DIRECTORY and the Snakefile's modification time."
result)
,cached))))
+(define-error 'snakemake-error "Snakemake process error")
+
+(defconst snakemake-error-buffer "*Snakemake process error*")
+
+(defun snakemake--display-error ()
+ (ignore-errors (kill-buffer snakemake-error-buffer))
+ (let ((buf (get-buffer-create snakemake-error-buffer)))
+ (copy-to-buffer buf (point-min) (point-max))
+ (with-current-buffer buf (help-mode))
+ (display-buffer buf)
+ (signal 'snakemake-error nil)))
+
(defun snakemake-insert-output (&rest args)
"Call `snakemake-program' with ARGS and insert output."
(apply #'call-process snakemake-program nil t nil args))
@@ -229,7 +241,7 @@ TYPE can be `all' or `target'."
(target "--list-target-rules")
(t (user-error "Invalid rule type: %s" type)))))
(buffer-string)
- (error "Error finding rules")))
+ (snakemake--display-error)))
t))
(defun snakemake-all-rules (&optional directory)
@@ -252,7 +264,7 @@ The file list is determined by the output of
(with-temp-buffer
(if (zerop (call-process snakemake-file-target-program nil t))
(buffer-string)
- (error "Error finding file targets")))))))
+ (snakemake--display-error)))))))
(defconst snakemake-invalid-target-re
(regexp-opt (list "MissingRuleException"