public void OnShutdown(Exception ex) { Logger.Log(Level.Error, "Driver shutdown with error", ex); byte[] errorBytes; try { errorBytes = ByteUtilities.SerializeToBinaryFormat(ex); } catch (SerializationException se) { Logger.Log(Level.Warning, "Unable to serialize exception", ex); errorBytes = ByteUtilities.SerializeToBinaryFormat( NonSerializableJobException.UnableToSerialize(ex, se)); } _driverServiceStub.Shutdown(new ShutdownRequest() { Exception = new ExceptionInfo() { NoError = false, Message = ex.Message, Name = ex.Source, Data = ByteString.CopyFrom(errorBytes) } }); }
public static ExceptionInfo SerializeException(Exception ex) { ByteString serializedException; try { serializedException = ByteString.CopyFrom(ByteUtilities.SerializeToBinaryFormat(ex)); } catch (SerializationException se) { Log.Log(Level.Warning, "Unable to serialize exception", ex); serializedException = ByteString.CopyFrom(ByteUtilities.SerializeToBinaryFormat( NonSerializableJobException.UnableToSerialize(ex, se))); } return(new ExceptionInfo() { NoError = false, Name = ex.GetType().ToString(), Message = ex.Message, Data = serializedException }); }