summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-02-16 18:27:25 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-02-16 18:27:25 +0100
commit483ba2cd668d93c1ca0824fd4ccca96a4d9b40cd (patch)
treec9fa915695094cfaa0ca28df2ca4dd845baf0865
parent734d79cdea31eeee49fc0f429ff12790eca8bb88 (diff)
low: set-attribute!: Reject attributes that are not supported.
-rw-r--r--drmaa/v1/low.scm27
1 files changed, 17 insertions, 10 deletions
diff --git a/drmaa/v1/low.scm b/drmaa/v1/low.scm
index 3003052..55d699e 100644
--- a/drmaa/v1/low.scm
+++ b/drmaa/v1/low.scm
@@ -262,16 +262,23 @@ not be affected by this."
#true
error-message)))
-(define (set-attribute! template name value)
- (let ((error-message
- (make-char* (bytevector->pointer
- (make-bytevector (DRMAA 'ERROR_STRING_BUFFER))))))
- (return (drmaa_set_attribute template
- (string->pointer name) value
- error-message
- (DRMAA 'ERROR_STRING_BUFFER))
- #true
- error-message)))
+(define set-attribute!
+ (let ((valid (get-attribute-names)))
+ (lambda (template name value)
+ (unless (member name valid)
+ (raise (condition
+ (&formatted-message
+ (format "This DRMAA implementation does not support the attribute `~a'.~%")
+ (arguments (list name))))))
+ (let ((error-message
+ (make-char* (bytevector->pointer
+ (make-bytevector (DRMAA 'ERROR_STRING_BUFFER))))))
+ (return (drmaa_set_attribute template
+ (string->pointer name) value
+ error-message
+ (DRMAA 'ERROR_STRING_BUFFER))
+ #true
+ error-message)))))
(define (get-attribute template name)
(let ((error-message