aboutsummaryrefslogtreecommitdiff
path: root/dotnet/Mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-04-30 16:53:16 +0100
committerMichael Williamson <mike@zwobble.org>2016-04-30 16:53:16 +0100
commitd71b9ef7b2ed7d72df132b5e38448fbbac7036be (patch)
treeb872d6a4aeac5f043a61bb0a856ec85e202469a3 /dotnet/Mammoth
parentff98a9a2804d5e7c042d6bb400cd9265cf00fa85 (diff)
Produce nicer error messages in C#
Diffstat (limited to 'dotnet/Mammoth')
-rw-r--r--dotnet/Mammoth/Couscous/HorribleHacks.cs4
-rw-r--r--dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs15
-rw-r--r--dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs8
-rw-r--r--dotnet/Mammoth/Mammoth.csproj2
4 files changed, 29 insertions, 0 deletions
diff --git a/dotnet/Mammoth/Couscous/HorribleHacks.cs b/dotnet/Mammoth/Couscous/HorribleHacks.cs
index 9f1ac30..c97dc0a 100644
--- a/dotnet/Mammoth/Couscous/HorribleHacks.cs
+++ b/dotnet/Mammoth/Couscous/HorribleHacks.cs
@@ -26,5 +26,9 @@ namespace Mammoth.Couscous {
internal static bool equals(this TokenType first, TokenType second) {
return first == second;
}
+
+ internal static string getMessage(this System.Exception exception) {
+ return exception.Message;
+ }
}
}
diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs b/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs
new file mode 100644
index 0000000..6ca9381
--- /dev/null
+++ b/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/LineParseException.cs
@@ -0,0 +1,15 @@
+using Mammoth.Couscous.java.lang;
+
+namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing {
+ internal class LineParseException : RuntimeException {
+ private readonly Token _token;
+
+ internal LineParseException(Token token, string message) : base(message) {
+ _token = token;
+ }
+
+ internal Token getToken() {
+ return _token;
+ }
+ }
+}
diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs b/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs
new file mode 100644
index 0000000..73f349c
--- /dev/null
+++ b/dotnet/Mammoth/Couscous/mammoth/internal/styles/parsing/ParseException.cs
@@ -0,0 +1,8 @@
+using Mammoth.Couscous.java.lang;
+
+namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.styles.parsing {
+ internal class ParseException : RuntimeException {
+ internal ParseException(string message) : base(message) {
+ }
+ }
+}
diff --git a/dotnet/Mammoth/Mammoth.csproj b/dotnet/Mammoth/Mammoth.csproj
index 4e945d0..6e2c473 100644
--- a/dotnet/Mammoth/Mammoth.csproj
+++ b/dotnet/Mammoth/Mammoth.csproj
@@ -81,6 +81,8 @@
<Compile Include="Couscous\java\util\Set.cs" />
<Compile Include="Couscous\mammoth\internal\docx\InMemoryDocxFile.cs" />
<Compile Include="Couscous\mammoth\internal\docx\ZippedDocxFile.cs" />
+ <Compile Include="Couscous\mammoth\internal\styles\parsing\LineParseException.cs" />
+ <Compile Include="Couscous\mammoth\internal\styles\parsing\ParseException.cs" />
<Compile Include="Couscous\mammoth\internal\util\Base64Encoding.cs" />
<Compile Include="Couscous\mammoth\internal\util\Casts.cs" />
<Compile Include="Couscous\mammoth\internal\util\Lists.cs" />