summaryrefslogtreecommitdiff
path: root/src/scm/webid-oidc/errors.scm
diff options
context:
space:
mode:
Diffstat (limited to 'src/scm/webid-oidc/errors.scm')
-rw-r--r--src/scm/webid-oidc/errors.scm68
1 files changed, 66 insertions, 2 deletions
diff --git a/src/scm/webid-oidc/errors.scm b/src/scm/webid-oidc/errors.scm
index 4a62abb..52f5db8 100644
--- a/src/scm/webid-oidc/errors.scm
+++ b/src/scm/webid-oidc/errors.scm
@@ -455,9 +455,10 @@
&external-error
'(issuer cause)))
-(define-public (raise-cannot-fetch-issuer-configuration issuer cause)
+(define*-public (raise-cannot-fetch-issuer-configuration issuer cause #:key (recoverable? #f))
(raise-exception
- ((record-constructor &cannot-fetch-issuer-configuration) issuer cause)))
+ ((record-constructor &cannot-fetch-issuer-configuration) issuer cause)
+ #:continuable? recoverable?))
(define-public &cannot-fetch-jwks
(make-exception-type
@@ -828,6 +829,47 @@
(raise-exception
((record-constructor &unconfirmed-provider) subject provider)))
+(define-public &neither-identity-provider-nor-webid
+ (make-exception-type
+ '&neither-identity-provider-nor-webid
+ &external-error
+ '(uri why-not-identity-provider why-not-webid)))
+
+(define-public (raise-neither-identity-provider-nor-webid uri why-not-identity-provider why-not-webid)
+ (raise-exception
+ ((record-constructor &neither-identity-provider-nor-webid)
+ uri why-not-identity-provider why-not-webid)))
+
+(define-public &token-request-failed
+ (make-exception-type
+ '&token-request-failed
+ &external-error
+ '(cause)))
+
+(define-public (raise-token-request-failed cause)
+ (raise-exception
+ ((record-constructor &token-request-failed) cause)))
+
+(define-public &profile-not-found
+ (make-exception-type
+ '&profile-not-found
+ &external-error
+ '(webid iss dir)))
+
+(define-public (raise-profile-not-found webid iss dir)
+ (raise-exception
+ ((record-constructor &profile-not-found) webid iss dir)))
+
+(define-public &no-provider-candidates
+ (make-exception-type
+ '&no-provider-candidates
+ &external-error
+ '(webid causes)))
+
+(define-public (raise-no-provider-candidates webid causes)
+ (raise-exception
+ ((record-constructor &no-provider-candidates) webid causes)))
+
(define*-public (error->str err #:key (max-depth #f))
(if (record? err)
(let* ((type (record-type-descriptor err))
@@ -1151,6 +1193,28 @@
((&unconfirmed-provider)
(format #f (G_ "~s does not admit ~s as an identity provider")
(get 'subject) (get 'provider)))
+ ((&neither-identity-provider-nor-webid)
+ (format #f (G_ "~a is neither an identity provider (because ~a) nor a webid (because ~a)")
+ (uri->string (get 'uri))
+ (recurse (get 'why-not-identity-provider))
+ (recurse (get 'why-not-webid))))
+ ((&token-request-failed)
+ (format #f (G_ "the token request failed (because ~a)")
+ (recurse (get 'cause))))
+ ((&profile-not-found)
+ (format #f (G_ "you don’t have a refresh token for identity ~a certified by ~a in ~s")
+ (uri->string (get 'webid))
+ (uri->string (get 'iss))
+ (get 'dir)))
+ ((&no-provider-candidates)
+ (format #f (G_ "all identity provider candidates for ~a failed: ~a")
+ (uri->string (get 'webid))
+ (string-join
+ (map (lambda (cause)
+ (format #f (G_ "~s failed (because ~a)")
+ (uri->string (car cause)) (recurse (cdr cause))))
+ (get 'causes))
+ (G_ ", "))))
((&compound-exception)
(let ((components (get 'components)))
(if (null? components)