Skip to content

Propagate exception object when error occurs - #69

Merged
sta merged 3 commits into
sta:masterfrom
zzattack:master
Aug 21, 2014
Merged

Propagate exception object when error occurs#69
sta merged 3 commits into
sta:masterfrom
zzattack:master

Conversation

@zzattack

Copy link
Copy Markdown
Contributor

Users (like me) may be interested to know the underlying exception when some error occurs. This patch makes ErrorEventArgs expose a field with this exception, if it's available.

@sta

sta commented Aug 21, 2014

Copy link
Copy Markdown
Owner

It looks nice.

And please:

  • Add a constructor.
    internal ErrorEventArgs (string message)
      : this (message, null)
    {
    }

    internal ErrorEventArgs (string message, Exception exception)
    {
      _message = message;
      _exception = exception;
    }

It's because optional parameters are available in C# 4.0 and later.

  • Add more xml doc comments to the Exception property, like the following.
    /// <summary>
    /// Gets the exception that caused the error.
    /// </summary>
    /// <value>
    /// A <see cref="Exception"/> instance that represents the cause of the error,
    /// or <see langword="null"/> if the error isn't due to an exception.
    /// </value>
    public Exception Exception {
    ...

@zzattack

Copy link
Copy Markdown
Contributor Author

As requested!

@sta

sta commented Aug 21, 2014

Copy link
Copy Markdown
Owner

I will merge this PR, and then add the following comment to those .cs files.

/*
 * Contributors:
 * - Frank Razenberg <frank@zzattack.org>
 */

Is it okay?

@zzattack

Copy link
Copy Markdown
Contributor Author

Absolutely, thanks for picking this up. No worries about the comment.

sta added a commit that referenced this pull request Aug 21, 2014
Propagate exception object when error occurs
@sta
sta merged commit 8b2ff10 into sta:master Aug 21, 2014
sta added a commit that referenced this pull request Aug 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants