B
Boogie El Aceitoso
Hi,
I have a class whose constructor accepts a filename and performs some actions
on it[1].
Some things might go wrong, such as not being the right kind of file, the file
doesn't exist, is read-only, etc...
I guess the only way to report an error inside a constructor is to raise an
exception, but it feels a bit extreme to raise an exception becuase a file
couldn't be found....
IS this the best design? Any comments would be appreciated. O
[1] I don't think it's relevant but in case you're curious, it reads all the
version information on it (product name, comapny name, etc...)
I have a class whose constructor accepts a filename and performs some actions
on it[1].
Some things might go wrong, such as not being the right kind of file, the file
doesn't exist, is read-only, etc...
I guess the only way to report an error inside a constructor is to raise an
exception, but it feels a bit extreme to raise an exception becuase a file
couldn't be found....
IS this the best design? Any comments would be appreciated. O
[1] I don't think it's relevant but in case you're curious, it reads all the
version information on it (product name, comapny name, etc...)