首页 \ 问答 \ 为什么Exception不是Throwable的实例?(Why Exception is not instance of Throwable?)

为什么Exception不是Throwable的实例?(Why Exception is not instance of Throwable?)

我认为在所有编程语言中Exception类都是Throwable接口的实例。

看一下下面的代码,它显示Exception不是php中的Throwable实例。

try {

    throw new InvalidArgumentException("error message");

} catch (InvalidArgumentException $e) {

    if ($e instanceof Exception) {
        echo '$e is exception';             // this line gets executed
    }

    if ($e instanceof Throwable) {
        echo '$e is throwable';             // but this one never
    }

}

它使链接异常成为​​问题,其中Exception类构造函数在其最后一个参数中接受Throwable

php版本: 5.6.23

有解决方案吗


I think in all programming languages Exception class is instance of Throwable interface.

Take a look at following code which shows Exception is not instance of Throwable in php.

try {

    throw new InvalidArgumentException("error message");

} catch (InvalidArgumentException $e) {

    if ($e instanceof Exception) {
        echo '$e is exception';             // this line gets executed
    }

    if ($e instanceof Throwable) {
        echo '$e is throwable';             // but this one never
    }

}

It makes problem with chaining exceptions where Exception class constructor accepts Throwable in it's last argument.

php version: 5.6.23

Any solution?


原文:https://stackoverflow.com/questions/43742976
更新时间:2023-05-06 19:05

最满意答案

您提到您的客户希望MSI使用自己的证书签名,但不想为您提供证书。 多么痛苦。

这真的只剩下2个选项:

  • 您向客户端提供要包含在MSI中的文件,并且您的客户端构建MSI,使用自己的证书对其进行签名。
  • 您构建一个MSI,将其提供给您的客户并要求他们构建另一个安装MSI的MSI(使用其证书签名)。 有关更多详细信息,请参见如何创建嵌套的.msi包

另一个选择是再次发布您的问题并包含MSI标记,以便更多MSI开发人员看到您的问题。 他们可能会想出更多的想法。

UPDATE

我今天和InstallShield(Flexera Software)谈过,我向他们询问了嵌套的MSI。 他们说你不应该嵌套MSI。 所以忘记这个主意。


Okay so this got resolved. Apparently, we CAN create an MSI package for an office addin without the need to sign it. I did exactly that and now the client will sign the package himself.

Thanks a lot for the replies :)

相关问答

更多
  • 显然,创建插件项目时,调试信息(如MS Office版本和用于调试的可执行文件路径)将保存在.CSPROJ文件中。 所以调试不能保证在另一台机器上工作。 该信息保存在项目文件的以下XML节点中: ProjectExtensions \ VisualStudio \ FlavorProperties \ ProjectProperties 就我而言,问题在于属性 OfficeVersion="14.0" DebugInfoExeName="#Software\Microsoft\Office\14.0\Wor ...
  • 1)检查是否存在“HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Microsoft SQL Server DMAddins \ Config”。 2)使用“InstallPath”值查找并运行“Microsoft.SqlServer.DataMining.Office.ServerConfiguration.exe” 1) Check if "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server DMA ...
  • 当你说你没有使用Visual Studio时,你的意思是你没有使用Visual Studio模板吗? 或者您在机器上没有Visual Studio(如果是这样,我可能建议您安装它 - 甚至只是免费/社区版)? 一旦你有了: 关闭所有Internet Explorer实例 转到Visual Studio - > Debug - > Attach to process 一定要选择“附加到”:“ 脚本代码 ” 选择所有iexplore.exe实例 点击“附加” 您现在应该获得完整的调试体验,完成控制台输出(“Ja ...
  • userProfile对象包含成员emailAddress ,它返回用户的SMTP电子邮件地址的String。 此成员可从1.0级别的API和使用示例看起来像... // Example: allieb@contoso.com Office.initialize = function (reason) { $(function () { console.log(Office.context.mailbox.userProfile.emailAddress); } } 请注 ...
  • CustomTaskPanes集合是ThisAddIn类的属性。 因此,您可以使用“this”在ThisAddIn_Startup方法中访问它。 句法。 如果您没有在intellisense / autocomplete中看到该集合。 这个问题可能是由于某些可能性引起的: 您没有使用VSTO(Visual Studio Tools for Office)2005 SE。 您使用的是VSTO 2005 SE,但是您安装的是之前未完全删除的VSTO v3 CTP。 您正在为不支持自定义任务窗格的应用程序(所有O ...
  • 64位不支持 32位加载项。 Microsoft建议使用32位版本的Office,除非您遇到32位进程的内存限制,如果您需要处理非常大的电子表格,这种情况很可能会发生: 要安装的Office 2010版本的建议如下: 如果组织中的用户依赖于Office的现有扩展,例如ActiveX控件,第三方加载项,基于以前版本的Office构建的内部解决方案,或者直接与Office连接的32位版本的程序,我们建议您在运行32位和64位支持的Windows操作系统的计算机上安装32位Office 2010(默认安装)。 如 ...
  • Office.initialize是加载项的基本组成部分; 如果主机支持加载项,则它支持Office.initialize。 Word,Excel,PowerPoint和Outlook for Mac都支持加载项。 Office.initialize is a fundamental part of add-ins; if a host supports add-ins then it supports Office.initialize. Word, Excel, PowerPoint, and Outl ...
  • 您提到您的客户希望MSI使用自己的证书签名,但不想为您提供证书。 多么痛苦。 这真的只剩下2个选项: 您向客户端提供要包含在MSI中的文件,并且您的客户端构建MSI,使用自己的证书对其进行签名。 您构建一个MSI,将其提供给您的客户并要求他们构建另一个安装MSI的MSI(使用其证书签名)。 有关更多详细信息,请参见如何创建嵌套的.msi包 。 另一个选择是再次发布您的问题并包含MSI标记,以便更多MSI开发人员看到您的问题。 他们可能会想出更多的想法。 UPDATE 我今天和InstallShield(Fl ...
  • 原来这个项目是2010年的前景。 我在gac中的Microsoft.VisualStudiols.Office.BuildTasks.dll的版本是v11,而不是它似乎需要的v10 (默认情况下)。 为什么visual studio CAN构建项目可能与csproj文件中的以下行有关:
    是。 请参阅_IDTExtensibility2,要导入ATL项目的DLL是什么? 用于IDTExtensibility2接口定义 是。 请记住,有Outlook特定的密钥可以使Outlook在HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins加载您的插件 这是IDTExtensibility2界面的Delphi定义: // *********************************************************** ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。