From d3dc21e2d3cbf75355b4bc386ee792dfab8fecb3 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Mon, 28 Nov 2011 15:34:51 -0600 Subject: [PATCH] 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 original commit: b40cc23f60239b4af50c5c9fad66dfdf8c48c9f4 --- collects/mred/private/wx/cocoa/finfo.rkt | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/collects/mred/private/wx/cocoa/finfo.rkt b/collects/mred/private/wx/cocoa/finfo.rkt index 300386ef..e248e6b8 100644 --- a/collects/mred/private/wx/cocoa/finfo.rkt +++ b/collects/mred/private/wx/cocoa/finfo.rkt @@ -86,9 +86,9 @@ (let ([fs (malloc 80)]) (let ([r (FSPathMakeRef s fs)]) (unless (zero? r) - (error 'file-creator-and-type "could not access file (~a): ~v" - r - s))) + (filesystem-error 'file-creator-and-type "could not access file (~a): ~v" + r + s))) fs)) (define (int->str v) @@ -103,16 +103,15 @@ (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" - r - path)))) + (filesystem-error 'file-creator-and-type "lookup failed (~a): ~e" + r + path)))) (define file-creator-and-type (case-lambda @@ -142,7 +141,14 @@ kFSCatInfoFinderInfo v)]) (unless (zero? r) - (error 'file-creator-and-type "change failed (~a): ~e" - r - path)))) + (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)))) \ No newline at end of file