Often, at least in small programs, when an exception is thrown you just
want to present a sensible message to the user and abort the current
operation.  Example:

        void doStuff(int i) { enforce(i >= 0, "Need nonnegative i"); }

        try doStuff(-1);
        catch (Exception e) writeln("Error: ", e.msg);

In this case, the user will see

        Error: b.d(5): Need nonnegative i

My point is that the user doesn't need to see the file and line number
that caused the error.  This is only useful for the programmer.  So I
suggest we make either of the following changes to enforce():

     1. Drop the file and line number from the message.  The Throwable
        class has dedicated 'file' and 'line' fields which we can
        populate with that information without polluting the error
        message.
     2. Another option is to include the file and line only in debug
        builds.

-Lars 


_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to