After sending this I realized that I could define my own exception types and use those. The original question, though, was how to get the built-in exception hierarchy expanded into something more fine-grained.
On Mon, Nov 28, 2016 at 7:46 PM, David Storrs <[email protected]> wrote: > I'm doing some "write files to disk" work and noticing that the exception > system for the filesystem isn't terribly fine-grained. Leaving aside > exceptions that pertain to Racket's module system we only have: > > exn:fail:filesystem (something went wrong in general) > and > exn:fail:filesystem:exists? (you tried to create a file that already > exists) > > If I'm, e.g. using rename-file-or-directory and it fails I need to parse > the actual message string to know what went wrong: > > (define msg (exn-message e)) ;; assume we're in a handler > (cond [(regexp-match #px"No such file or directory" msg) ...] > [(regexp-match #px"the destination file already exists" msg) > ...]) > > This is verbose, error-prone, and vulnerable to changes in the messages > that could happen in future versions of Racket. > > I would prefer to have exception types that deal with this -- for example: > > exn:fail:filesystem:source-not-found > exn:fail:filesystem:target-exists > > > What would be involved in doing this? Should I be filing a feature > request on Github? > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

