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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to