Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-09-28 10:25:14

> Sorry, John. That wasn't meant to be flaimbait :)

None taken.

> Hi, Reece. I've little knowledge of the "right way" here, but the
> code in question does exactly what you suggest. It's just that it
> "plays God"
> a little and decides that only some errors are real errors. If the
> error isn't recognised then it tells the caller that all is well.
> Given that my code is of the form
> if (exists(path) && is_directory(path)) ...
> exists(path) returns true ATM causing is_directory(path) to
> throw_exception when it can't find path. Given that I'm not using
> exceptions in this code, I'd rather it lied conservatively rather
> than optimistically, if you get
> what I mean...


The reason it's this way in the first place is that sometimes exists() was
returning inconsistent values: in particular returning false when the file
clearly did exist. However, depending on network traffic, which way the
wind was blowing etc, the problem may or may not show up. Nice reliable OS
this :-)

> The cure to my immediate problem is to have the actual error that my
> user is experiencing added to the list of known errors. My intuition
> tells me to expect ERROR_INVALID_DRIVE but I know we shouldn't write
> code based on intuition :) I'll post back the actual error as and when
> my bug reporter gets back to me with the results from a modified
> version of the code. (I got it to throw_exception instead of return
> true.)
> It strikes me that a useful addition to the code here would be to get
> the code to output a debug message indicating the (uncoded for but
> probably valid) error code.

Good idea, an OutputDebugString here would be a useful addition IMO.


Boost list run by bdawes at, gregod at, cpdaniel at, john at