You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by ma...@apache.org on 2016/12/02 18:58:58 UTC

reef git commit: [REEF-1670] Add exception information to FormatJavaExceptionMessage

Repository: reef
Updated Branches:
  refs/heads/master 1e1fff6f2 -> cf42937fc


[REEF-1670] Add exception information to FormatJavaExceptionMessage

This change adds all exception information (exception message
and inner exceptions) to output of FormatJavaExceptionMessage
to allow it to propagate to Yarn diagnostic.

JIRA:
  [REEF-1670](https://issues.apache.org/jira/browse/REEF-1670)

Pull request:
  This closes #1185


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/cf42937f
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/cf42937f
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/cf42937f

Branch: refs/heads/master
Commit: cf42937fc7582c9e375d05b7ef3efcc75b348c31
Parents: 1e1fff6
Author: andrey-me <an...@microsoft.com>
Authored: Fri Nov 18 14:10:10 2016 -0800
Committer: Mariia Mykhailova <ma...@apache.org>
Committed: Fri Dec 2 10:18:36 2016 -0800

----------------------------------------------------------------------
 lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp | 12 ++++++++++--
 lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h   |  4 +++-
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/cf42937f/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
index 89e0e34..628e7ba 100644
--- a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
@@ -129,6 +129,14 @@ JNIEnv* RetrieveEnv(JavaVM* jvm) {
   return env;
 }
 
-String^ FormatJavaExceptionMessage(String^ errorMessage, Exception^ exception) {
-  return String::Concat(errorMessage, Environment::NewLine, exception->StackTrace);
+String^ FormatJavaExceptionMessage(String^ errorMessage, Exception^ exception, int recursionDepth) {
+	
+	return (!exception)
+		? String::Concat(errorMessage, "null")
+		: recursionDepth >= 0
+			? String::Concat(errorMessage, Environment::NewLine,
+				exception->Message, Environment::NewLine,
+				exception->StackTrace, Environment::NewLine,
+				FormatJavaExceptionMessage( "Inner Exception: ", exception->InnerException, --recursionDepth))
+			: String::Concat(errorMessage, exception->GetType(), " ...");
 }

http://git-wip-us.apache.org/repos/asf/reef/blob/cf42937f/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
index aa50ddd..c06377c 100644
--- a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
@@ -58,7 +58,9 @@ jbyteArray JavaByteArrayFromManagedByteArray(
 
 JNIEnv* RetrieveEnv(JavaVM* jvm);
 
-String^ FormatJavaExceptionMessage(String^ errorMessage, Exception^ exception);
+const int defaultRecursionDepthForExceptionFormat = 3;
+
+String^ FormatJavaExceptionMessage(String^ errorMessage, Exception^ exception, int recursionDepth = defaultRecursionDepthForExceptionFormat);
 
 void HandleClr2JavaError(
   JNIEnv *env,