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