通用错误处理器
- 更新时间2025-07-30
- 阅读时长8分钟
发生错误时,显示有错误发生。如发生一个错误,该VI返回错误描述,或选择性地打开一个对话框。

输入/输出
[user-defined descriptions]
—
[user-defined descriptions] is an array of descriptions of user-defined codes. 如输入错误与用户定义代码中的某项匹配,VI可在消息中返回用户定义描述的相应说明信息。
[user-defined codes]
—
[user-defined codes] is an array of numeric error codes you can use to define error codes and messages for your own VIs. VI可在对错误代码的内部数据库进行搜索后,搜索该数组。错误代码-8999至-8000、5000至9999、500000至599999为用户保留,用于用户自定义错误信息。
[error code] (0)
—
[error code] is a numeric error code. 如错误输入表明有错误,VI可忽略错误代码。如无错误,VI可对其进行检测。非0值表示错误。
[error source] (" ")
—
[error source] is an optional string you can use to describe the source of error code.
search ni.com link visible?(T)
—
search ni.com link visible? determines whether the Search ni.com for error hyperlink appears in the dialog box. Set to TRUE to display the hyperlink. Clicking the hyperlink opens search results for the error code on ni.com in the default web browser. The hyperlink appears only for LabVIEW-defined error codes in the development environment. The default is TRUE.
type of dialog (OK msg:1)
—
type of dialog determines what type of dialog box to display, if any.
error in (no error)
—
error in describes error conditions that occur before this node runs. This input contains status, code, and source, which provide standard error in cluster element functionality.
[exception action] (none:0)
—
[exception action] is a way for you to create exceptions to error handling. 如错误代码和错误源等于异常代码和异常源,VI可执行异常操作。如异常源使用默认值,只需异常代码匹配VI即可进行异常操作。
[exception code]
—
[exception code] is the error code that you want to treat as an exception. The default is 0.
[exception source]
—
[exception source] is the error message that you want to use to test for an exception. The default is an empty string.
error?
—
error? returns TRUE if an error occurs. If this VI finds an error, it sets the parameters in the error cluster.
code out
—
code out is the error code indicated by error in or error code.
source out
—
源输出表明错误的源。 源输出字符串比错误输入的源字符串更具描述性。
message
—
message describes the error code that occurred, the source of the error, and a description of the error. 如VI未返回对于错误的说明,可采取措施查找错误代码说明。如果同一错误代码存在多个描述,VI 将显示所有描述,并用 或 分隔。
error out
—
error out contains error information. This output provides standard error out functionality. |
[user-defined descriptions]
—
[user-defined codes]
—
[error code] (0)
—
[error source] (" ")
—
search ni.com link visible?(T)
—
type of dialog (OK msg:1)
—
error in (no error)
—
error?
—
code out
—
source out
—
error out
—