From e8463d700589fed1301aff8fdd4762b61727f86f Mon Sep 17 00:00:00 2001 From: mainzelm Date: Mon, 16 Sep 2002 16:16:04 +0000 Subject: [PATCH] Turn error hierarchie upside down. --- scheme/lib/dns.scm | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/scheme/lib/dns.scm b/scheme/lib/dns.scm index a0fcfe8..14f811f 100644 --- a/scheme/lib/dns.scm +++ b/scheme/lib/dns.scm @@ -90,56 +90,56 @@ ;; --- error conditions -(define-condition-type 'invalid-type '()) + +;; supertype of all errors signaled by this library +(define-condition-type 'dns-error '(error)) +(define dns-error? (condition-predicate 'dns-error)) + +(define-condition-type 'invalid-type '(dns-error)) (define invalid-type? (condition-predicate 'invalid-type)) -(define-condition-type 'invalid-class '()) +(define-condition-type 'invalid-class '(dns-error)) (define invalid-class? (condition-predicate 'invalid-class)) -(define-condition-type 'parse-error '()) +(define-condition-type 'parse-error '(dns-error)) (define parse-error? (condition-predicate 'parse)) -(define-condition-type 'unexpected-eof-from-server '()) +(define-condition-type 'unexpected-eof-from-server '(dns-error)) (define unexpected-eof-from-server? (condition-predicate 'unexpected-eof-from-server)) -(define-condition-type 'bad-address '()) +(define-condition-type 'bad-address '(dns-error)) (define bad-address? (condition-predicate 'bad-address)) -(define-condition-type 'no-nameservers '()) +(define-condition-type 'no-nameservers '(dns-error)) (define no-nameservers? (condition-predicate 'no-nameservers)) -(define-condition-type 'not-a-hostname '()) +(define-condition-type 'not-a-hostname '(dns-error)) (define not-a-hostname? (condition-predicate 'not-a-hostname)) -(define-condition-type 'not-a-ip '()) +(define-condition-type 'not-a-ip '(dns-error)) (define not-a-ip? (condition-predicate 'not-a-ip)) +;; supertype of all errors signaled if the dns server returned a non-sero +;; reply code +(define-condition-type 'dns-server-error '(dns-error)) +(define dns-server-error? (condition-predicate 'dns-server-error)) -(define-condition-type 'dns-format-error '()) +(define-condition-type 'dns-format-error '(dns-server-error)) (define dns-format-error? (condition-predicate 'dns-format-error)) -(define-condition-type 'dns-server-failure '()) +(define-condition-type 'dns-server-failure '(dns-server-error)) (define dns-server-failure? (condition-predicate 'dns-server-failure)) -(define-condition-type 'dns-name-error '()) +(define-condition-type 'dns-name-error '(dns-server-error)) (define dns-name-error? (condition-predicate 'dns-name-error)) -(define-condition-type 'dns-not-implemented '()) +(define-condition-type 'dns-not-implemented '(dns-server-error)) (define dns-not-implemented? (condition-predicate 'dns-not-implemented)) -(define-condition-type 'dns-refused '()) +(define-condition-type 'dns-refused '(dns-server-error)) (define dns-refused? (condition-predicate 'dns-refused)) -(define-condition-type 'dns-error '(dns-format-error - dns-server-failure - dns-name-error - dns-not-implemented - dns-refused)) - -(define dns-error? (condition-predicate 'dns-error)) - - ;; called by the error-handlers, prints out error descriptions (define (dns-error-messages condition more) (display "dns-error: ")