public FailedEvaluator(IFailedEvaluatorClr2Java clr2Java) { FailedEvaluatorClr2Java = clr2Java; _id = FailedEvaluatorClr2Java.GetId(); _failedContexts = new List <IFailedContext>( FailedEvaluatorClr2Java.GetFailedContextsClr2Java().Select(clr2JavaFailedContext => new FailedContext(clr2JavaFailedContext))); var errorBytes = FailedEvaluatorClr2Java.GetErrorBytes(); if (errorBytes != null && errorBytes.Length != 0) { // When the Exception originates from the C# side. Exception inner; try { inner = (Exception)ByteUtilities.DeserializeFromBinaryFormat(errorBytes); } catch (SerializationException se) { inner = NonSerializableEvaluatorException.UnableToDeserialize( "Exception from Evaluator was not able to be deserialized, returning a NonSerializableEvaluatorException.", se); } _evaluatorException = new EvaluatorException(_id, inner.Message, inner); } else { // When the Exception originates from Java. _evaluatorException = new EvaluatorException( _id, FailedEvaluatorClr2Java.GetJavaCause(), FailedEvaluatorClr2Java.GetJavaStackTrace()); } }
private static EvaluatorException CreateEvaluatorException(EvaluatorInfo eval) { var failureInfo = eval.Failure; var errorBytes = failureInfo.Exception.Data.ToByteArray(); if (errorBytes == null || errorBytes.Length == 0) { Logger.Log(Level.Error, "Exception without object details: {0}", failureInfo.Exception.Message); return(new EvaluatorException( eval.EvaluatorId, failureInfo.Exception.Message, string.Join(";", failureInfo.Exception.StackTrace))); } // When the Exception originates from the C# side. Exception inner; try { inner = (Exception)ByteUtilities.DeserializeFromBinaryFormat(errorBytes); } catch (SerializationException se) { inner = NonSerializableEvaluatorException.UnableToDeserialize( "Exception from Evaluator was not able to be deserialized, returning a NonSerializableEvaluatorException.", se); } return(new EvaluatorException(eval.EvaluatorId, inner.Message, inner)); }
public Exception AsError() { if (Data.IsPresent()) { Exception inner; try { inner = (Exception)ByteUtilities.DeserializeFromBinaryFormat(Data.Value); } catch (SerializationException se) { inner = NonSerializableEvaluatorException.UnableToDeserialize( "Exception from Evaluator was not able to be deserialized, returning a NonSerializableEvaluatorException.", se); } return(new JobException(Id, Message, inner)); } else { return(new JobException(Id, Message)); } }