reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Weimer <mar...@weimo.de>
Subject Re: [DISCUSS] Deprecate Exceptions.Throw?
Date Thu, 02 Jun 2016 23:02:32 GMT
On 2016-06-02 2:22 PM, Julia Wang (QIUHE) wrote:
> The log level is always Error as it is throwing an exception .

That is part of the problem. In many cases, we write code that deals
with the exception, e.g. if it is caused by a network timeout, where we 
just try again. In that case, the exception is not an ERROR. It might be 
best to not log it at all, really.

I like the principles for exception handling that Sergey dug up for 
Java: Exceptions should be logged exactly once, when they cause the 
system to crash.

> I can only speak for the original purpose of this lib. The value was
> to have a consistent way to log error for analyzing logs in future.

I do not thing we have achieved that. We log exceptions more than once
in this way, conflate the control flow and potentially mess up 
optimizations by the compiler. And that is just our code. We have no way 
of nudging application code to use the same API.

That said, if there is something wrong with exception handling in .NET, 
we should file a bug against it [0].

Markus

[0]: https://github.com/dotnet/coreclr/issues

Mime
View raw message