问题标签 [error-suppression]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
79 浏览

osx-lion - 在 Lion 中禁用“恢复 Windows”消息

我们有一个在后台扫描第 3 方插件的进程。每次进程崩溃时,Lion 似乎都会弹出这个“应用程序 X 意外退出...”。

我们怎样才能压制这些信息?

谢谢

0 投票
1 回答
203 浏览

php - opendir 试图找到现在不存在的路径,因为它们已重命名

我正在为 dirs 设置重命名功能,作为 crud 系统的一部分,并正确设置了一个过程来重命名上传目录的子目录,并且重命名过程正在工作,这意味着 dirs 正在相应地重命名,但我从 opendir 收到错误代码. 显然找不到路径,因为它们是已重命名的路径。不知道如何解决这个价值百万美元的问题?

控制器:

0 投票
7 回答
1659 浏览

php - 如何抑制“不是有效的 MySQL 结果资源”错误

我有一个简单的脚本来检查用户上传了多少文件:

如果表 $username 没有任何文件不为空的行,它会吐出:

“警告:mysql_num_rows():提供的参数不是有效的 MySQL 结果资源...”

我能做些什么来避免这种情况?有没有一种简单的方法可以简单地禁止显示此错误消息?还是一个简单的“if”语句可以阻止 SQL 查询首先发生?

0 投票
6 回答
7607 浏览

c# - I miss Visual Basic's "On Error Resume Next" in C#. How should I be handing errors now?

In Visual Basic I wrote just On Error Resume Next in the head of my program and errors were suppressed in the entire project.

Here in C# I miss this feature very much. The usual try-catch handling for every single procedure is not only very time-intensive, it brings undesired effects. If an error is encountered, even if handled, the code doesn't continue from the point it occurred. With On Error Resume Next, the code continued from the point of error, skipping just the function call that caused the error.

I am not deeply involved with C# yet, but maybe there exists in C# a better error handling than the primitive try-catch.

I also would like to have the module or function name where the error occured as well as the the line number in my error message. The Exception class doesn't provide that features as far I know. Any ideas (managed, of course, without involving any process classes on my own application)?

How do you handle the errors in bigger projects? I hope I do not have to add a try-catch to each method. Somehow C# throws many errors - that seems to be typical of the language.

My Solution which I found to re-solve several of my problems:

0 投票
1 回答
1759 浏览

php - 停止来自 php 函数 gzuncompress 的错误消息

以下 php 代码在控制台“数据错误”上输出。发生这种情况的原因是一个已知问题,但我想摆脱错误消息。

我在网上搜索了如何抑制 php 上的错误消息并尝试了以下方法,但没有成功:

非常感谢!

0 投票
1 回答
333 浏览

ruby-on-rails - Rails:不显示“无效”在errors.full_messages

我只想显示属性的错误,而不是某个对象在视图中无效。我怎么能处理这个?

我目前使用这个:

这显示了所有类型的错误,这是正确的。但它也显示了<model> is not valid我想要抑制的错误。

我该如何处理?

提前致谢!

0 投票
1 回答
11350 浏览

opencv - 使用 OpenCV 将光栅图像转换为矢量图形?

我正在寻找一种使用 OpenCV 将光栅图像转换为矢量数据的可能性。在那里我发现了一个cv::findContours()似乎有点原始的函数(更可能我没有完全理解它):

它似乎只使用黑白图像(没有灰度和彩色图像),并且似乎不接受任何可能有助于噪声图像的过滤/错误抑制参数,以避免非常短的矢量线或避免不均匀的折线单一的,直线将是更好的结果。

所以我的问题是:OpenCV 是否有可能对彩色光栅图像进行矢量化,然后将颜色信息分配给生成的 polylinbes?以及如何将降噪和错误抑制应用于这样的算法?

谢谢!

0 投票
0 回答
226 浏览

gdb - 奇怪的 gdbserver 输出显示在我的目标设备上

当我在 uclinux 目标设备 blackfin bfin537/stamp 上运行 gdbserver 时,它工作得很好,但它总是会产生烦人的输出 Request to get for unknown register 232 Request to get for unknown register 236

这是非常烦人的,因为 gdb 客户端的每一步都会在输出屏幕终端 RS232 上导致几个该错误我被建议更改 bfin 编译器版本并使用不同版本的 uclinux 重建 gdb 服务器,....没有一个工作,甚至用不同版本的 bfin-uclinux-gcc 编译我的代码都没有解决我的问题。

我决定重新编译 gdbserver.c 并消除产生错误的行,但实际上该行在任何用于编译的 gdbserver 相关文件中都不存在。

我决定通过运行 gdbserver :3298 process 1>/dev/null 2>/dev/null 来抑制 gdb 服务器的 stderr 输出,但这并没有解决它如何配置我的 gdb 客户端以请求特定的寄存器(bfin- uclinux-gdb) 与 bfin537-stamp 相关吗?

我认为这个错误起源于 uclinux 系统后台系统进程中的其他地方。我想找到哪个进程在 stderr,stdout 中写入我不知道它并且我想抑制它的输出?

我应该在busybox shell 或/bin/bash 中更改某些内容以消除所有stderr 输出,这意味着如果我将所有父shell 输出或stderr 发送到/dev/null 谢谢

0 投票
3 回答
321 浏览

php - PHP @ 代替 isset 来测试 $_GET 值

给我一个很好的理由这样做

而不是这个

我要的是这个非常具体的代码案例,而不是一般的!

不欢迎以下原因:

  • using@将使应用程序减慢几纳秒,因为无论如何都会创建错误(即使它被抑制)。 ” 我更喜欢较慢的代码但更具可读性。
  • 使用@是坏习惯。 ”一般来说这可能是正确的,但我不相信这种情况(此外,坏习惯可能取决于上下文,在 PHP 手册中的函数中,就像fopen他们建议@在某些情况下使用的那样,请参阅错误/ http://www.php.net/manual/en/function.fopen.php的例外情况)
0 投票
5 回答
4833 浏览

css - 如何抑制 IntelliJ Idea 12 中的错误

我有很多关于 CSS 中的背景图像的错误。这是因为部署相对路径将与我的开发环境不同。

这些都是无关紧要的错误,我知道我无能为力。我想关闭对此的检查,以便再次发现真正的错误。

我检查了设置和项目结构,没有看到任何有希望的东西,但我不禁想到我以前在某处读过如何做到这一点。