You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by do...@apache.org on 2015/11/01 05:10:39 UTC
incubator-reef git commit: [REEF-895] Exceptions.CaughtAndThrow does
not preserve stack trace of the original Exception
Repository: incubator-reef
Updated Branches:
refs/heads/master 89e74cba8 -> d1c5c2422
[REEF-895] Exceptions.CaughtAndThrow does not preserve stack trace of the original Exception
This addressed the issue by
* Use ``ExceptionDispatchInfo.Capture(ex).Throw()``.
* Replace occurrences of throw ex.
JIRA:
[REEF-895](https://issues.apache.org/jira/browse/REEF-895)
Pull request:
This closes #603
Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/d1c5c242
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/d1c5c242
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/d1c5c242
Branch: refs/heads/master
Commit: d1c5c2422b44db2963a3153f8ce3dbf015283f80
Parents: 89e74cb
Author: Andrew Chung <af...@gmail.com>
Authored: Fri Oct 30 12:03:13 2015 -0700
Committer: Dongjoon Hyun <do...@apache.org>
Committed: Sun Nov 1 13:09:22 2015 +0900
----------------------------------------------------------------------
lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs | 3 +--
lang/cs/Org.Apache.REEF.Utilities/Diagnostics/Exceptions.cs | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/d1c5c242/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs b/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs
index ed51e7d..721d85d 100644
--- a/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs
+++ b/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs
@@ -339,8 +339,7 @@ namespace Org.Apache.REEF.Evaluator
{
var message = "Unhandled exception caught in Evaluator. Current files in the working directory: " +
GetDirectoryListing(Directory.GetCurrentDirectory());
- _logger.Log(Level.Error, message, ex);
- throw ex;
+ Utilities.Diagnostics.Exceptions.Throw(ex, message, _logger);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/d1c5c242/lang/cs/Org.Apache.REEF.Utilities/Diagnostics/Exceptions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Utilities/Diagnostics/Exceptions.cs b/lang/cs/Org.Apache.REEF.Utilities/Diagnostics/Exceptions.cs
index bb1a56a..2332bd3 100644
--- a/lang/cs/Org.Apache.REEF.Utilities/Diagnostics/Exceptions.cs
+++ b/lang/cs/Org.Apache.REEF.Utilities/Diagnostics/Exceptions.cs
@@ -18,6 +18,7 @@
*/
using System;
+using System.Runtime.ExceptionServices;
using System.Text;
using Org.Apache.REEF.Utilities.Logging;
@@ -51,7 +52,7 @@ namespace Org.Apache.REEF.Utilities.Diagnostics
{
logger.Log(Level.Error, logMessage, exception);
}
- throw exception;
+ ExceptionDispatchInfo.Capture(exception).Throw();
}
/// <summary>
@@ -151,7 +152,7 @@ namespace Org.Apache.REEF.Utilities.Diagnostics
{
logger.Log(level, logMessage, exception);
}
- throw exception;
+ ExceptionDispatchInfo.Capture(exception).Throw();
}
/// <summary>