Function: epg-error-to-string

epg-error-to-string is a byte-compiled function defined in epg.el.gz.

Signature

(epg-error-to-string ERROR)

Source Code

;; Defined in /usr/src/emacs/lisp/epg.el.gz
(defun epg-error-to-string (error)
  (cond
   ((eq (car error) 'exit)
    "Exit")
   ((eq (car error) 'quit)
    "Canceled")
   ((eq (car error) 'no-data)
    (let ((entry (assq (cdr error) epg-no-data-reason-alist)))
      (if entry
	  (format "No data (%s)" (downcase (cdr entry)))
	"No data")))
   ((eq (car error) 'unexpected)
    (let ((entry (assq (cdr error) epg-unexpected-reason-alist)))
      (if entry
	  (format "Unexpected (%s)" (downcase (cdr entry)))
	"Unexpected")))
   ((eq (car error) 'bad-armor)
    "Bad armor")
   ((memq (car error) '(invalid-recipient invalid-signer))
    (concat
     (if (eq (car error) 'invalid-recipient)
	 "Unusable public key"
       "Unusable secret key")
     (let ((entry (assq 'requested (cdr error))))
       (if entry
	   (format ": %s" (cdr entry))
	 ": <unknown>"))
     (let ((entry (assq 'reason (cdr error))))
       (if (and entry
		(> (cdr entry) 0)	;no specific reason given
		(setq entry (assq (cdr entry)
				  epg-invalid-recipients-reason-alist)))
	   (format " (%s)" (downcase (cdr entry)))
	 ""))))
   ((eq (car error) 'no-pubkey)
    (format "No public key: %s" (cdr error)))
   ((eq (car error) 'no-seckey)
    (format "No secret key: %s" (cdr error)))
   ((eq (car error) 'no-recipients)
    "No recipients")
   ((eq (car error) 'no-signers)
    "No signers")
   ((eq (car error) 'delete-problem)
    (let ((entry (assq (cdr error) epg-delete-problem-reason-alist)))
      (if entry
	  (format "Delete problem (%s)" (downcase (cdr entry)))
	"Delete problem")))
   ((eq (car error) 'key-not-created)
    "Key not created")))