【发布时间】:2013-06-19 18:32:35
【问题描述】:
我用 C# 编写了一个 ActiveX 控件,使用 COM 互操作来公开方法/属性。
[ComVisible(true)]
class COMClass:ICOMClass
{
public string methodA()
{
string str = "abc";
if(str != "abcd")
throw new Exception("invalid string");
return str;
}
}
[ComVisible(true)]
interface ICOMClass
{
string methodA();
}
有没有办法在javascript中处理C#抛出的异常?我找遍了都找不到?
例如。
var x = new ActiveXObject("COMClass");
try{
x.methodA
}
catch(e) {
alert(e);
}
【问题讨论】:
标签: c# javascript activex