예제 #1
0
        public T GetResult <T>(MessagePayloadDataConverter messageDataConverter, MessagePayloadDataConverter errorDataConverter)
        {
            if (this.IsException)
            {
                Exception e = null;

                // do a best-effort attempt at deserializing this exception
                try
                {
                    var type = Type.GetType(this.ExceptionType, true);
                    e = (Exception)errorDataConverter.Deserialize(this.Result, type);
                }
                catch
                {
                }

                if (e == null)
                {
                    // Could not deserialize. Let's just wrap it legibly,
                    // to help developers figure out what happened
                    e = new FunctionFailedException($"Entity operation threw {this.ExceptionType}, content = {this.Result}");
                }

                throw e;
            }
            else if (this.Result == null)
            {
                return(default(T));
            }
            else
            {
                return(messageDataConverter.Deserialize <T>(this.Result));
            }
        }
 public object GetInput(Type inputType, MessagePayloadDataConverter dataConverter)
 {
     try
     {
         return(dataConverter.Deserialize(this.Input, inputType));
     }
     catch (Exception e)
     {
         throw new EntitySchedulerException($"Failed to deserialize input for operation '{this.Operation}': {e.Message}", e);
     }
 }