如何处理 DotNetNuke 中的对象数据源异常处理
我创建了几个 DNN (5.2.3) 模块,我发现如果对象数据源 (ODS) 上发生错误,DNN 就会向每个人显示该错误。下面显示了一个示例(尽管在本例中不是 ODS 特定错误)。这对用户来说没有任何意义。对于用户来说,异常实际上应该是“未找到东西”或类似的内容。问题是这个 DropDownList 绑定到 ODS。所以我的问题是:
- 在 DNN 中如何覆盖此行为以使用 ODS 绑定显示有用的消息?
- 如果无法捕获特定异常以向用户提供有用的消息,在 DNN 中如何覆盖此行为以显示当前模块所有错误的通用异常?
样本: “SelectedThingDropDown”的 SelectedValue 无效,因为它不存在于项目列表中。参数名称:值
PS>我知道 try/catch Exceptions.ProcessModuleException(e,ex)。问题是这不适用于 ODS 绑定,除非我做错了什么。
I've created several DNN (5.2.3) modules and I'm finding that if an error happens on the object data source (ODS) DNN will then show that error to everyone. A sample (though not a ODS specific error in this case) is shown below. This has no meaning to user. The exception should really be "Thing not found" or something like that to the user. The problem is that this DropDownList is bound to an ODS. So my questions are:
- How in DNN can I override this behavior to show a helpful message using ODS binding?
- How in DNN can I override this behavior to show a generalized exception for all errors for the current module, if a specific exception cannot be caught to give a helpful message to the user?
Sample:
'SelectedThingDropDown' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
PS> I know about try/catch Exceptions.ProcessModuleException(e,ex). The problem is this does not work for ODS binding, unless I'm doing something wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在处理 ODS 和 DropDownList 时,您可以检查许多地方。这是其中一些的列表。
请记住,仅当您不处理异常时才会出现模块加载异常,如果您觉得它们对您没有帮助的话用户,您可以通过您自己的用户通知方法在 try catch 的帮助下覆盖它们,正如您所说。但不要忘记在事件日志中为错误创建条目,以便您可以跟踪错误并对其进行优化。
祝你好运。
There are number of places you can inspect while dealing with ODS and DropDownList. Here is list of some of them.
Keep in mind that module load exception will be there only if you are not handling the exceptions, if you feel they are not helpfull to user, you can override them by your own user notification method with the help of try catch as you said. but don't forget to create entries in the event log for the error so that you can track your errors and optimize them.
Good luck.