Change name of error object.

master
Thomas Hintz 11 years ago
parent f98d722bf6
commit f354c5e29c

@ -1,7 +1,7 @@
(in-package :cl-sendgrid)
(define-condition sendgrid-error (error)
((message :initarg :message :reader message)))
((sendgrid-error-message :initarg :sendgrid-error-message :reader sendgrid-error-message)))
(defun send-email (&key api-user api-key subject to text html from)
(let ((r (parse (flexi-streams:octets-to-string
@ -17,4 +17,5 @@
:object-as :alist)))
(if (string-equal (cdr (assoc "message" r :test #'string-equal)) "success")
t
(error 'sendgrid-error :message (cdr (assoc "errors" r :test #'string-equal))))))
(error 'sendgrid-error :sendgrid-error-message
(cdr (assoc "errors" r :test #'string-equal))))))

Loading…
Cancel
Save