reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Chung <afchun...@gmail.com>
Subject Re: [DISCUSS] Deprecate Exceptions.Throw?
Date Tue, 31 May 2016 20:32:46 GMT
I disagree. Even then, an API like `Exception
GenerateAndTrace(Exception e)` would be much more natural, such that
one can throw an Exception without disrupting the control flow, e.g.
`throw Exceptions.GenerateAndTrace(new Exception(message))`. Something
that can potentially work even better would be to have a class
ExceptionManager, with injectable actions that perform traces on each
Exception, e.g.

```
public sealed class ExceptionManager {
    private readonly ReadOnlySet<IExceptionAction> _actions;

    ExceptionManager(ISet<IExceptionAction> actions) {
        _actions = new ReadOnlySet<IExceptionAction>(actions);
    }

    public Exception GenerateAndTrace(Exception ex) {
        foreach(var action in _actions) {
            action.Act(ex);
        }

        return ex;
    }
}
```

with the default IExceptionAction performing Exception traces.

Thanks,
Andrew

On Tue, May 31, 2016 at 10:16 AM, Julia Wang (QIUHE)
<Qiuhe.Wang@microsoft.com> wrote:
> -1
>
> I understand most people don't like it because at this time, we haven't really started
to leverage logs to do something. Moving forward, we will need to use log to get statics data
for monitoring , diagnose, etc. Have a centralized the place would be convenient for us to
have a consistent logs.
>
> When we work on monitoring in the near future, if we are sure we would want to use some
different approaches and those logs are not useful at all, we can consider to remove at that
time.
>
> Julia
>
> -----Original Message-----
> From: Markus Weimer [mailto:markus@weimo.de]
> Sent: Tuesday, May 31, 2016 7:43 AM
> To: dev@reef.apache.org
> Subject: Re: [DISCUSS] Deprecate Exceptions.Throw?
>
> On 2016-05-26 21:26, Julia Wang (QIUHE) wrote:
>> I understand the issue. We introduced Exceptions clas and bunch of
>> methods, it was to unify the way to log exception messages and control
>> the behavior so that we can have a centralized place.
>
> So, are you in favor of keeping it?
>
> Markus

Mime
View raw message