Skip to content

Commit 87db081

Browse files
zpgitmartinweismann
authored andcommitted
CSharp binding: create Exception class and throw it instead of the default one.
1 parent 70934cc commit 87db081

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/buildbindingcsharp.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
967967
w.Writeln(" }")
968968
w.Writeln("")
969969
}
970-
w.Writeln(" throw new Exception(sMessage + \"(# \" + errorCode + \")\");")
970+
w.Writeln(" throw new ExternalException(sMessage, errorCode);")
971971
w.Writeln(" }")
972972

973973
w.Writeln("")
@@ -1172,6 +1172,10 @@ func buildCSharpExample(componentdefinition ComponentDefinition, w LanguageWrite
11721172
}
11731173
w.Writeln(" Console.WriteLine(versionString);")
11741174
w.Writeln(" }")
1175+
w.Writeln(" catch (ExternalException ex)")
1176+
w.Writeln(" {")
1177+
w.Writeln(" Console.WriteLine(\"Code: \" + ex.ErrorCode + \", Message: \" + ex.Message);")
1178+
w.Writeln(" }")
11751179
w.Writeln(" catch (Exception e)")
11761180
w.Writeln(" {")
11771181
w.Writeln(" Console.WriteLine(\"Exception: \\\"\" + e.Message + \"\\\"\");")

0 commit comments

Comments
 (0)