summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-02-16 12:00:13 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-02-16 12:00:13 +0100
commitb3387c879b420c8ee3d4871d2902c52c7a41dcb6 (patch)
tree790cc0cd701240e925a734718969c14a6f133b8e
parentbe421cf23358c760c236b330cd4b04f24cb0258c (diff)
Only use &drmaa-error for external errors.
-rw-r--r--drmaa/errors.scm5
-rw-r--r--drmaa/v1/high.scm6
-rw-r--r--drmaa/v1/low.scm7
3 files changed, 8 insertions, 10 deletions
diff --git a/drmaa/errors.scm b/drmaa/errors.scm
index 76dcec2..2831414 100644
--- a/drmaa/errors.scm
+++ b/drmaa/errors.scm
@@ -21,6 +21,7 @@
#:use-module (srfi srfi-35)
#:export (&drmaa-error
drmaa-error?
+ drmaa-error-code
&formatted-message
formatted-message?
@@ -28,7 +29,9 @@
formatted-message-arguments))
(define-condition-type &drmaa-error &error
- drmaa-error?)
+ drmaa-error?
+ (code drmaa-error-code))
+
(define-condition-type &formatted-message &error
formatted-message?
diff --git a/drmaa/v1/high.scm b/drmaa/v1/high.scm
index bef0680..9b3d5a2 100644
--- a/drmaa/v1/high.scm
+++ b/drmaa/v1/high.scm
@@ -63,7 +63,6 @@
(and (memq #:required? options)
(or (member keyword initargs)
(raise (condition
- (&drmaa-error)
(&formatted-message
(format "~a: required field `~a' missing.~%")
(arguments (list (class-name klass)
@@ -80,7 +79,6 @@
;; TODO: allow for better error messages
(or (validate value)
(raise (condition
- (&drmaa-error)
(&formatted-message
(format "~a: field `~a' has the wrong type.~%")
(arguments (list (class-name klass)
@@ -95,7 +93,6 @@
(() #t)
(extraneous
(raise (condition
- (&drmaa-error)
(&formatted-message
(format "~a: extraneous fields: ~{~a ~}~%")
(arguments (list (class-name klass)
@@ -180,7 +177,6 @@
(lambda (item)
(or (member item '(error input output))
(raise (condition
- (&drmaa-error)
(&message
(message "transfer-files: must be a list containing the symbols error, input, or output."))))))
value)))
@@ -215,7 +211,6 @@
(_ #false))
value))
(raise (condition
- (&drmaa-error)
(&message
(message "environment: must be a list of pairs."))))))
#:transform (lambda (value)
@@ -232,7 +227,6 @@
(or (and (list? value)
(every string? value))
(raise (condition
- (&drmaa-error)
(&message
(message "emails: must be a list of strings."))))))
#:drmaa-name (low:DRMAA 'V_EMAIL))
diff --git a/drmaa/v1/low.scm b/drmaa/v1/low.scm
index 93f7f42..97e9a67 100644
--- a/drmaa/v1/low.scm
+++ b/drmaa/v1/low.scm
@@ -18,6 +18,7 @@
(define-module (drmaa v1 low)
#:use-module (drmaa v1 ffi)
+ #:use-module (drmaa errors)
#:use-module (bytestructures guile)
#:use-module (system foreign)
#:use-module (system ffi-help-rt)
@@ -100,11 +101,11 @@ STRING-LIST."
((eq? ret (DRMAA 'ERRNO_SUCCESS)) success)
(else
(raise (condition
+ (&drmaa-error (code ret))
(&message
(message
- (format #false "~a (~a)"
- (char*->string error-message)
- ret))))))))
+ (format #false "~a"
+ (char*->string error-message)))))))))
(define (DRMAA sym)
(or (drmaa-v1-ffi-symbol-val (symbol-append 'DRMAA_ sym))