koculu / ZoneTree

ZoneTree is a persistent, high-performance, transactional, ACID-compliant ordered key-value database for NET. It can operate in memory or on local/cloud storage.

Home Page:https://tenray.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Make WriteAheadLogCorruptionException more informative

dvakor opened this issue · comments

Is your feature request related to a problem? Please describe.
At this time WriteAheadLogCorruptionException has property Dictionary<int, Exception> Exceptions, it is assumed that these are internal exceptions, but they are not rendering in any ways.
So it is a little bit hard to understand whats goes wrong.

https://github.com/koculu/ZoneTree/blob/main/src/ZoneTree/Exceptions/WriteAheadLogCorruptionException.cs

Describe the solution you'd like
It would be nice that inner exception messages includes into main.

Describe alternatives you've considered
Provide aggregate exception to a base class. For example:

public class ImprovedWriteAheadLogCorruptionException : ZoneTreeException
{
    public Dictionary<int, Exception> Exceptions { get; }

    public ImprovedWriteAheadLogCorruptionException(long segmentId,
        Dictionary<int, Exception> exceptions)
        : base($"Write ahead log with segment id = {segmentId} is corrupted.", new AggregateException(exceptions.Values))
    {
        Exceptions = exceptions;
    }
}