<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 27, 2014 at 1:55 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 27 October 2014 13:36, Alexander Kornienko <<a href="mailto:alexfh@google.com">alexfh@google.com</a>> wrote:<br>
> Also, I don't like the boilerplate code that saves the old diagnostic<br>
> handler, sets the new one, and then restores the old one after the use of<br>
> the Linker.<br>
><br>
> Maybe add some kind of a scoped handler for the users that just need to<br>
> handle an error from a single api call?<br>
<br>
<br>
</span>So, by "get an error" you mean "get a diagnostic message", right?</blockquote><div><br></div><div>Exactly.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> The<br>
main intention of the patch was to split two very different concerns:<br>
<br>
* Informing the caller that something has failed. This should be a<br>
bool or, if more information is needed, an error_code with simple<br>
errors like: different_triple, read_error, etc.<br>
<br>
* Providing diagnostics for the human: "appending variable 'foo' has<br>
different types in different modules".<br>
<br>
I went with at DiagnosticInfo because that is what was at hand, but I<br>
agree there was more boilerplate than I was hopping for.<br>
<br>
What about passing an optional diagnostic handler? If nullptr is<br>
passed, the system one is used. </blockquote><div><br></div><div>That could also work. We'd still need an adapter to avoid writing a handler function each time.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I will write a patch to see what it<br>
looks like and post it in this thread.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br>
</div></div>