From b78f8acb504cf8e6100e754baf58c19b9c989dd4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 19 Dec 2007 15:36:35 +0000 Subject: [PATCH] catch sxref failures and report as warnings when loading help data svn: r8063 --- collects/scribble/xref.ss | 4 +++- collects/scribblings/reference/sandbox.scrbl | 6 +++--- collects/scribblings/scribble/xref.scrbl | 3 ++- collects/setup/xref.ss | 11 +++++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/collects/scribble/xref.ss b/collects/scribble/xref.ss index f445b0a0fa..4440ca82fd 100644 --- a/collects/scribble/xref.ss +++ b/collects/scribble/xref.ss @@ -40,7 +40,9 @@ [ci (send renderer collect null null)]) (for-each (lambda (src) (parameterize ([current-namespace (namespace-anchor->empty-namespace here)]) - (send renderer deserialize-info (src) ci))) + (let ([v (src)]) + (when v + (send renderer deserialize-info v ci))))) sources) (make-xrefs renderer (send renderer resolve null null ci)))) diff --git a/collects/scribblings/reference/sandbox.scrbl b/collects/scribblings/reference/sandbox.scrbl index 33540f0ff1..70ca13f609 100644 --- a/collects/scribblings/reference/sandbox.scrbl +++ b/collects/scribblings/reference/sandbox.scrbl @@ -401,12 +401,12 @@ first is a timeout value in seconds, and the second is a memory limit in megabytes. Either one can be @scheme[#f] for disabling the corresponding limit; alternately, the parameter can be set to @scheme[#f] to disable all limits (in case more are available in -future versions). +future versions). The default is @scheme[(list 30 20)]. When limits are set, @scheme[call-with-limits] (see below) is wrapped around each use of the evaluator, so consuming too much time or memory -results in an exception. You can change the limits of a running -evaluator using @scheme[set-eval-limits].} +results in an exception. Change the limits of a running evaluator +using @scheme[set-eval-limits].} @; ---------------------------------------------------------------------- diff --git a/collects/scribblings/scribble/xref.scrbl b/collects/scribblings/scribble/xref.scrbl index 0d01223b29..db39dead52 100644 --- a/collects/scribblings/scribble/xref.scrbl +++ b/collects/scribblings/scribble/xref.scrbl @@ -27,7 +27,8 @@ by @scheme[load-xref], @scheme[#f] otherwise.} Creates a cross-reference record given a list of functions that each produce a serialized information obtained from @xmethod[render% -serialize-info]. +serialize-info]. If a @scheme[sources] element produces @scheme[#f], +its result is ignored. Since the format of serialized information is specific to a rendering class, the optional @scheme[using-render%] argument accepts the diff --git a/collects/setup/xref.ss b/collects/setup/xref.ss index ddc51de7fb..63717c4674 100644 --- a/collects/setup/xref.ss +++ b/collects/setup/xref.ss @@ -41,7 +41,14 @@ dirs)))]) (set! cached-xref (load-xref (map (lambda (dest) (lambda () - (let ([r (with-input-from-file dest read)]) - (cadr r)))) + (with-handlers ([exn:fail? (lambda (exn) + (fprintf (current-error-port) + "WARNING: ~a\n" + (if (exn? exn) + (exn-message exn) + (format "~e" exn))) + #f)]) + (let ([r (with-input-from-file dest read)]) + (cadr r))))) dests))) cached-xref))))