aboutsummaryrefslogtreecommitdiff
path: root/Mammoth/DocumentConverter.cs
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-05-07 21:44:57 +0000
committerMichael Williamson <mike@zwobble.org>2015-05-07 21:44:57 +0000
commit1ccd812fd633ca0f5da89b0fb6acfbf3136868d2 (patch)
tree008bb43baaae96f87a277f7168ceb34c91d8084a /Mammoth/DocumentConverter.cs
parentc3f394bb9b6a91ccde7b2255e46db463afc63652 (diff)
Read messages from result
Diffstat (limited to 'Mammoth/DocumentConverter.cs')
-rw-r--r--Mammoth/DocumentConverter.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Mammoth/DocumentConverter.cs b/Mammoth/DocumentConverter.cs
index 84c1f85..6057cbd 100644
--- a/Mammoth/DocumentConverter.cs
+++ b/Mammoth/DocumentConverter.cs
@@ -1,6 +1,7 @@
using EdgeJs;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
@@ -16,7 +17,14 @@ namespace Mammoth
var result = f(File.ReadAllBytes(path));
Task.WaitAll(result);
- return new Result<string>((string)result.Result, new List<Message>());
+ return ReadResult(result.Result);
+ }
+
+ private Result<string> ReadResult(dynamic result)
+ {
+ var rawMessages = (dynamic[])result.messages;
+ var messages = rawMessages.Select(message => Message.Warning((string)message.message)).ToList();
+ return new Result<string>(result.value, messages);
}
private static string ReadResource(string resourceName)