首页 \ 问答 \ 显示自定义异常消息(Show Custom Exception Message)

显示自定义异常消息(Show Custom Exception Message)

我正在尝试显示自定义异常消息,同时保留内部异常。

这是我的示例代码:

public class Class1
{
public Class1()
{
    try
    {
        throw new WebException("Initial Exception");
    }
    catch (WebException we)
    {
        throw new myException("Custom Message", we);
    }
}
}

public class myException : WebException
{
public myException(string msg, WebException e) : base(msg, e) { }
}

当我运行此代码时,它会在调试器中显示自定义消息: Screenshot1

但仍然将innerexception消息发送给客户端: Screenshot2

我在这做错了什么? 如何在显示自己的自定义消息时保留内部异常?


I'm trying to show a custom exception message while preserving the inner exception.

Here is my sample code:

public class Class1
{
public Class1()
{
    try
    {
        throw new WebException("Initial Exception");
    }
    catch (WebException we)
    {
        throw new myException("Custom Message", we);
    }
}
}

public class myException : WebException
{
public myException(string msg, WebException e) : base(msg, e) { }
}

When I run this code it shows me the custom message in the debugger: Screenshot1

yet still sends the innerexception message to the client: Screenshot2

What am I doing wrong here? How do I preserve the inner exception while showing my own custom message?


原文:https://stackoverflow.com/questions/10541851
更新时间:2023-01-09 20:01

最满意答案

简短的回答是:不,服务器端脚本无法从FileMaker文件导入。 来自FM的帮助网站: http//help.filemaker.com/app/answers/detail/a_id/7035/~/import%2Fexport-script-on-filemaker-server

通过FileMaker Server预定脚本不支持直接导入/导出另一个FileMaker Pro文件。

是的,导出到临时目录中的.xlsx,.csv或.txt文件是一种常见的解决方法。 我经常使用它。 如果要避免使用临时文件,还可以将所有索引获取到变量并循环遍历它们,从而创建记录。 HyperLists可以派上用场。


The short answer is: no, Server Side Scripts can't import from a FileMaker file. From FM's help site: http://help.filemaker.com/app/answers/detail/a_id/7035/~/import%2Fexport-script-on-filemaker-server

Importing/exporting directly to and from another FileMaker Pro file is not supported via a FileMaker Server scheduled script.

Yes, exporting to an .xlsx, .csv or .txt file in the temporary directory is a common work-around. I use it frequently. If you want to avoid a temporary file, you can also grab all of the indices to a variable and loop through them, creating records. HyperLists come in handy for this.

相关问答

更多
  • 您需要在元素中声明源文档的命名空间,为其分配前缀并在寻址源文档的元素时使用该前缀。 所以你的样式表的根元素看起来像这样: (请注意,这里没有必要声明Filemaker命名空间),并且需要将获取数据的调用更改为:
  • 我会使用fmp:// URL协议。 您可以将其称为Web URL,但FileMaker Pro会注册以处理所有fmp://调用。 您将以fmp://server.ip.address.or.dns.name/filemakerDatabaseName格式使用它。 您甚至可以使用它来调用脚本并将参数/变量发送到数据库。 有关更多信息,请参阅http://www.filemaker.com/help/12/fmp/html/sharing_data.16.7.html 。 I would use the fmp ...
  • 简短的回答是:不,服务器端脚本无法从FileMaker文件导入。 来自FM的帮助网站: http : //help.filemaker.com/app/answers/detail/a_id/7035/~/import%2Fexport-script-on-filemaker-server 通过FileMaker Server预定脚本不支持直接导入/导出另一个FileMaker Pro文件。 是的,导出到临时目录中的.xlsx,.csv或.txt文件是一种常见的解决方法。 我经常使用它。 如果要避免使用临时 ...
  • 要设置映射,请使用对示例XML和XSLT文件的固定引用。 在命令选项中输入它们,然后设置字段映射; 它将解析文件并显示字段(和示例数据),以便您可以查看发生了什么事情。 准备好映射后,将引用替换为变量。 你也可以同时使用:添加两行,一行是变量,另一行是固定路径,如下所示: $xml Samples/Sample.xml FileMaker文件引用可以有多个路径; FileMaker将使用第一个有效的文件。 当你运行脚本并将$xml变量设置为某个路径时,它将选择此路径; 当您编辑脚本时,变量将不会被设置,因 ...
  • 这是(大致)如何在Filemaker脚本中执行此操作: Go to Layout [ “YourTable” ] # FIND THE RECORDS OF INTEREST Perform Find [ Restore ] Go to Record/Request/Page [ First ] Loop New Window [ ] # ISOLATE THE CURRENT RECORD Show All Records Omit Record S ...
  • 您从有问题的记录中调用此函数的脚本。 此脚本可以在客户端运行,也可以通过FileMaker Server上的计划或通过执行服务器脚本脚本步骤运行。 语法如下所示: BE_ExportFieldContents(field; outputPath) 其中'field'参数是容器字段,'outputPath'是您希望文件结束的位置。 通常你通过设置变量脚本步骤来调用这些函数。 执行后变量包含调用的任何错误或结果。 请注意,该插件需要在服务器上安装并启用,才能在其中工作。 You make a script wh ...
  • 我必须说我不确定我是否理解你在这里需要什么。 如果我明白了 - 你没有得到价值 通过使用 编辑: 如果是这种情况,请尝试使用ITEM / @注册,如下 ...
  • Import_History_All :: fk_SourceID = Import_History_All_Self_Join :: fk_SourceID 上面的关系是一个连接,它将导致在门户中显示具有指定源ID的每个记录。 基本上,上面的关系将在IMPORT HISTORY表中显示具有相同SourceID的指定门户记录。 如果您想查看您所在记录的sourceID的最新记录,那么这将是所需的关系,剩下的就是对门户网站进行排序并过滤以仅显示最新值。 如果您只想要当前使用的SourceID的最新导入,那么这 ...
  • 您只需要使用FileMaker PHP API中记录的setField方法(这里是FileMaker_Record类文档的页面),然后使用commit提交您的记录: ... $record->setField('d15', 'new value'); $record->commit(); ... You just need to use the setField method as documented in the FileMaker PHP API (here's the page for the d ...
  • FileMaker ExecuteSQL可能不支持此功能。 我建议使用能够运行终端命令的插件,然后使用该插件通过FileMaker在终端中执行操作。 有一个免费的插件,它有一个函数,它被称为BaseElements。 以下是有关此特定功能文档的链接。 https://baseelementsplugin.zendesk.com/hc/en-us/articles/205350547-BE-ExecuteShellCommand 如果您尝试将数据插入MySQL表,更好的方法是使用FileMaker ESS(外 ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。