Hi Marco,

On Fri, Nov 6, 2015 at 10:57 AM, Marco Massenzio <[email protected]> wrote:
> So, in addition to what Michael suggests, and in line with Alex's
> exhortation to have "excellent core error reporting facilities," I would
> also like to propose that we consider adopting a pattern I've seen
> elsewhere:
>
> if (errorOccurred) {
>   string msg = "Dude, something went wrong!";
>   LOG(ERROR) << msg;
>   return Error(msg);
> }
>
> or a variation thereof.

I'd like to understand what you see as the advantage of doing this *in
addition to* adding line number + source file information to the Error
object itself. i.e., if the Error carries around information about the
context in which it was constructed, this would seem to avoid the need
to grep for error strings.

My concern with the pattern you suggested is that (a) it adds logic at
every site where we're generating errors, and (b) not every place
where we construct an Error will have enough context about what went
wrong to be able to report the problem accurately.

Neil

Reply via email to