diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2021-02-16 18:27:52 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2021-02-16 18:27:52 +0100 |
commit | d4013cb6d2fc9479152bf0e08118fb2bf1a7661d (patch) | |
tree | 5b06ca683d76c45992234010f70172212e7dac52 | |
parent | 483ba2cd668d93c1ca0824fd4ccca96a4d9b40cd (diff) |
low: set-vector-attribute!: Reject attributes that are not supported.
-rw-r--r-- | drmaa/v1/low.scm | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drmaa/v1/low.scm b/drmaa/v1/low.scm index 55d699e..4e9ac55 100644 --- a/drmaa/v1/low.scm +++ b/drmaa/v1/low.scm @@ -296,18 +296,25 @@ not be affected by this." (char*->string value) error-message))) -(define (set-vector-attribute! template name . values) - (let ((error-message - (make-char* (bytevector->pointer - (make-bytevector (DRMAA 'ERROR_STRING_BUFFER))))) - (array (make-cstr-array values))) - (return (drmaa_set_vector_attribute template - name - (bytevector->pointer array) - error-message - (DRMAA 'ERROR_STRING_BUFFER)) - #true - error-message))) +(define set-vector-attribute! + (let ((valid (get-vector-attribute-names))) + (lambda (template name . values) + (unless (member name valid) + (raise (condition + (&formatted-message + (format "This DRMAA implementation does not support the vector attribute `~a'.~%") + (arguments (list name)))))) + (let ((error-message + (make-char* (bytevector->pointer + (make-bytevector (DRMAA 'ERROR_STRING_BUFFER))))) + (array (make-cstr-array values))) + (return (drmaa_set_vector_attribute template + name + (bytevector->pointer array) + error-message + (DRMAA 'ERROR_STRING_BUFFER)) + #true + error-message))))) (define (get-vector-attribute template name) (let ((error-message |