I think the answer is probably to pass the *class* of the exception. 
The default then simply sends the correct #signalWith: message with the
file name as an argument.

Bill



Wilhelm K. Schwab, Ph.D.
University of Florida
Department of Anesthesiology
PO Box 100254
Gainesville, FL 32610-0254

Email: [EMAIL PROTECTED]
Tel: (352) 846-1285
FAX: (352) 392-7029

>>> [EMAIL PROTECTED] 08/15/08 11:39 AM >>>
Alexandre Bergel wrote:
> At the first glance readOnlyFileNamed:ifNone: seems to be a useful 
> primitive. But this having the file absent might be just one case. You

> could have ifNotReadable:, ifParentFolderNotReadable:.
> Also, an error when writing in a file may occur in many different 
> situation (disk full, file read only, ...).
> You may also want to provide handler for each of these situation
(e.g., 
> writeFileNamed: aName with: stream ifDiskFull: [...] 
> ifAlreadyExistingFile: [...]...

Agree...

>> I agree you are improving on the existing code, but I would prefer
>> something like
>>
>>  file := fd readOnlyFileNamed:name ifNone:[ ^self ].

a solution would be to pass in any Exception into the ifNone: block:

file := fd readOnlyFileNamed:name ifNone:[:ex| ^self ].

Then depending on whether you are actually interested in the exact 
reason the file couldn't be created you could look at the exception.

Michael

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to