get_error_textget_error_textGetErrorTextGetErrorTextget_error_text (算子)

名称

get_error_textget_error_textGetErrorTextGetErrorTextget_error_text — 查询 HALCON 错误号的错误文本。

签名

get_error_text( : : ErrorCode : ErrorMessage)

Herror get_error_text(const Hlong ErrorCode, char* ErrorMessage)

Herror T_get_error_text(const Htuple ErrorCode, Htuple* ErrorMessage)

void GetErrorText(const HTuple& ErrorCode, HTuple* ErrorMessage)

static HString HSystem::GetErrorText(Hlong ErrorCode)

static void HOperatorSet.GetErrorText(HTuple errorCode, out HTuple errorMessage)

static string HSystem.GetErrorText(int errorCode)

def get_error_text(error_code: int) -> str

描述

算子 get_error_textget_error_textGetErrorTextGetErrorTextGetErrorTextget_error_text returns the error message for the corresponding HALCON error code. This is indeed the same text which will be given during an exception. The operator get_error_textget_error_textGetErrorTextGetErrorTextGetErrorTextget_error_text is especially useful if the error treatment is programmed by the users themselves (see also set_check(::'~give_error':)set_check("~give_error")SetCheck("~give_error")SetCheck("~give_error")SetCheck("~give_error")set_check("~give_error")).

注意

Unknown error codes will trigger a standard message.

执行信息

参数

ErrorCodeErrorCodeErrorCodeErrorCodeerrorCodeerror_code (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

HALCON error code.

限制: 1 <= ErrorCode && ErrorCode <= 36000

ErrorMessageErrorMessageErrorMessageErrorMessageerrorMessageerror_message (输出控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Corresponding error message.

示例(C)

Herror   err;
char       message[MAX_STRING];

set_check("~give_error");
err = send_region(region,socket);
set_check("give_error");
if (err != H_MSG_TRUE) {
get_error_text((Hlong)err,message);
  fprintf(stderr,"my error message: %s\n",message);
  exit(1);
}

结果

算子 get_error_textget_error_textGetErrorTextGetErrorTextGetErrorTextget_error_text 返回值 2 ( H_MSG_TRUE) , if the parameters are correct.否则将抛出异常。

可能的前趋

set_checkset_checkSetCheckSetCheckSetCheckset_check

另见

set_checkset_checkSetCheckSetCheckSetCheckset_check

模块