Skip to content

Commit b4d7017

Browse files
committed
CSharp binding: create Exception class and throw it instead of the default one.
1 parent c9fd78c commit b4d7017

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
@@ -957,7 +957,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
957957
w.Writeln(" }")
958958
w.Writeln("")
959959
}
960-
w.Writeln(" throw new Exception(sMessage + \"(# \" + errorCode + \")\");")
960+
w.Writeln(" throw new ExternalException(sMessage, errorCode);")
961961
w.Writeln(" }")
962962
w.Writeln("")
963963

@@ -1116,6 +1116,10 @@ func buildCSharpExample(componentdefinition ComponentDefinition, w LanguageWrite
11161116
}
11171117
w.Writeln(" Console.WriteLine(versionString);")
11181118
w.Writeln(" }")
1119+
w.Writeln(" catch (ExternalException ex)")
1120+
w.Writeln(" {")
1121+
w.Writeln(" Console.WriteLine(\"Code: \" + ex.ErrorCode + \", Message: \" + ex.Message);")
1122+
w.Writeln(" }")
11191123
w.Writeln(" catch (Exception e)")
11201124
w.Writeln(" {")
11211125
w.Writeln(" Console.WriteLine(\"Exception: \\\"\" + e.Message + \"\\\"\");")

0 commit comments

Comments
 (0)