Program logic bugs vs input/environmental errors

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 28 02:01:13 PDT 2014


On 2014-09-28 03:24, Steven Schveighoffer wrote:

> Library code often cannot make that choice. The issue with exceptions
> vs. errors is that often you don't know where the input comes from.
>
> e.g.:
>
> auto f = File(someInternalStringThatIsCorrupted) -> error
> auto f = File(argv[1]) -> exception
>
> How does File know what it's target file name came from?

Both of theses should throw an exception. Most stuff related to file 
operations should throw an exception, not an error.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list