change file-creator-and-type so that it raises exn:fail:filesystem?

exceptions instead of exn:fail exceptions for errors having to do
with the actual attempt to change/retrieve the creator and type
(but leaving alone the type errors)

closes PR 12400
This commit is contained in:
Robby Findler 2011-11-28 15:34:51 -06:00
parent d580518e66
commit b40cc23f60

View File

@ -86,7 +86,7 @@
(let ([fs (malloc 80)])
(let ([r (FSPathMakeRef s fs)])
(unless (zero? r)
(error 'file-creator-and-type "could not access file (~a): ~v"
(filesystem-error 'file-creator-and-type "could not access file (~a): ~v"
r
s)))
fs))
@ -103,14 +103,13 @@
(arithmetic-shift (bytes-ref v 2) 8)
(bytes-ref v 3)))
(define (get-info v fs path)
(let ([r (FSGetCatalogInfo fs
kFSCatInfoFinderInfo
v
#f #f #f)])
(unless (zero? r)
(error 'file-creator-and-type "lookup failed (~a): ~e"
(filesystem-error 'file-creator-and-type "lookup failed (~a): ~e"
r
path))))
@ -142,7 +141,14 @@
kFSCatInfoFinderInfo
v)])
(unless (zero? r)
(error 'file-creator-and-type "change failed (~a): ~e"
(filesystem-error 'file-creator-and-type "change failed (~a): ~e"
r
path))))
(void)]))
(define (filesystem-error sym fmt . args)
(raise (exn:fail:filesystem
(string-append (format "~a: " sym)
(apply format fmt args))
(current-continuation-marks))))