f_GetErrorInfo()获取系统错误信息函数

Pb技术 专栏收录该内容
6 篇文章 0 订阅

/* ======================================================= */
// 名称:f_GetErrorInfo()
// 中文名称:(数据获取)获取系统错误信息函数
// 作用:错误信息反馈
// 参数:ERROR aerr_Info
// 返回值:STRING //返回空字符串表示无错误
// 原作者:偶
// 备注:不需要再使用了系统标准的Error变量,返回空字符串表示没有错误
/* ======================================================= */


IF IsNull(aerr_Info) THEN RETURN "Error对象为空" //NULL
IF NOT IsValid(aerr_Info) THEN RETURN "Error对象没有实例化" //NON ISVALID

IF aerr_Info.Number=0 THEN RETURN ""

STRING ls_ErrMessage
STRING ls_ErrText

CHOOSE CASE aerr_Info.Number
CASE 1
//By Zero
ls_ErrMessage="数学错误,出现被零除"
CASE 2
//Null Object Reference
ls_ErrMessage="程序中引用了空对象"
CASE 3
//Array Boundary Exceeded
ls_ErrMessage="数组出现越界访问"
CASE 4
//Enumerated Value Is Out Of Range For Function
ls_ErrMessage="枚举值超出函数范围"
CASE 5
//Negative Value Encountered In Function
ls_ErrMessage="函数中遇到否定值"
CASE 6
//Invalid DataWindow Row/Column Specified
ls_ErrMessage="数据窗口中存在非法的行或列"
CASE 7
//Unresolvable External When Linking Reference
ls_ErrMessage="链接调用时,出现不可确认的外部对象引用"
CASE 8
//Reference Of Array With Null Subscript
ls_ErrMessage="引用带有空下标的数组"
CASE 9
//DLL Function Not Found In Current Application
ls_ErrMessage="当前应用程序中没有找到动态链接库的函数"
CASE 10
//Unsupported Argument Type In DLL Function
ls_ErrMessage="出现DLL库函数不支持的参数类型"
CASE 11
//Object File Is Out Of Date And Must Be Converted To Current Version
ls_ErrMessage="对象文件已过期,必须转换为当前的PowerBuilder版本"
CASE 12
//DataWindow Column Type Does Not Match GetItem Type
ls_ErrMessage="数据窗口列类型与GetItem函数的类型不匹配"
CASE 13
//Unresolved Property Reference
ls_ErrMessage="未知的属性引用"
CASE 14
//Error Opening DLL Library For External Function
ls_ErrMessage="为外部函数调用而打开动态链接库时发生错误"
CASE 15
//Error Calling External Function Name
ls_ErrMessage="错误调用外部函数"
CASE 16
//Maximum String Size Exceeded
ls_ErrMessage="字符串长度超越了最大限制"
CASE 17
//DataWindow Referenced In DataWindow Object Does Not Exist
ls_ErrMessage="数据窗口控件中引用的数据窗口对象不存在"
CASE 18
//Function Does Not Return Value
ls_ErrMessage="必须返回值的函数没有返回值"
CASE 19
//Cannot Convert Name In Any Variable To Name
ls_ErrMessage="不能将任意变量中的数据类型转换为其他数据类型"
CASE 20
//Database Command Has Not Been Successfully Prepared
ls_ErrMessage="没有成功地准备好数据库命令"
CASE 21
//Bad Runtime Function Reference
ls_ErrMessage="引用了错误的运行时函数"
CASE 22
//Unknown Object Type
ls_ErrMessage="未知的对象类型"
CASE 23
//Cannot Assign Object Of Type Name To Variable Of Type Name
ls_ErrMessage="不能将对象赋给变量,两种类型不能赋值"
CASE 24
//Function Call Does Not Match Its Definition
ls_ErrMessage="函数调用与其定义不匹配"
CASE 25
//Double Or Real Expression Has Overflowed
ls_ErrMessage="DOUBLE或者REAL表达式溢出"
CASE 26
//Field Name Assignment Not Supported
ls_ErrMessage="不支持对某种数据类型的字段的赋值"
CASE 27
//Cannot Take A Negative To A Noninteger Power
ls_ErrMessage="不能计算一个负数的非整数次方"
CASE 28
//VBX Error
ls_ErrMessage="某种数据类型的变量引起VBX错误"
CASE 29
//Nonarray Expected In Any Variable
ls_ErrMessage="ANY数据类型变量必需是非整组类型"
CASE 30
//External Object Does Not Support Data Type Name
ls_ErrMessage="外部对象不支持这种数据类型"
CASE 31
//External Object Data Type Name Not Supported
ls_ErrMessage="这种数据类型不支持外部对象"
CASE 32
//Name Not Found Calling External Object Function Name
ls_ErrMessage="调用外部对象函数时,未找到函数名"
CASE 33
//Invalid Parameter Type Calling External Object Function Name
ls_ErrMessage="调用外部对象函数时,参数类型不合法"
CASE 34
//Incorrect Number Of Parameters Calling External Object Function Name
ls_ErrMessage="调用外部对象函数时,使用不正确的参数个数"
CASE 35
//Error Calling External Object Function Name
ls_ErrMessage="错误调用外部对象函数"
CASE 36
//Name Not Found Accessing External Object Property Name
ls_ErrMessage="访问外部对象属性时,未找到名称"
CASE 37
//Type Mismatch Accessing External Object Property Name
ls_ErrMessage="访问外部对象属性时,类型不匹配"
CASE 38
//Incorrect Number Of Subscripts Accessing External Object Property Name
ls_ErrMessage="询问外部对象属性时,下标数目不正确"
CASE 39
//Error Accessing External Object Property Name
ls_ErrMessage="错误访问外部对象属性"
CASE 40
//Mismatched Any Data Types In Expression
ls_ErrMessage="与表达式中的数据类型不匹配"
CASE 41
//Illegal Any Data Type In Expression
ls_ErrMessage="表达式中有不合法的数据类型"
CASE 42
//Specified Argument Type Differs From Required Argument Type At Runtime In DLL Function Name
ls_ErrMessage="在DLL库函数中,运行时所指定的参数类型与所要求的参数类型不相同"
CASE 43
//Parent Object Does Not Exist
ls_ErrMessage="父对象不存在"
CASE 44
//Function Has Conflicting Argument Or Return Type In Ancestor
ls_ErrMessage="祖先的函数中发生具有冲突的参数及返回类型"
CASE 45
//Internal Table Overflow; Maximum Number Of Objects Exceeded
ls_ErrMessage="内部表溢出;对象的最大数目已经超越允许值"
CASE 46
//Null Object Reference Can Not Be Assigned Or Passed To A Variable Of This Type
ls_ErrMessage="空对象引用不能被赋值或传递给同类型的变量"
CASE 47
//Array Expected In Any Variable
ls_ErrMessage="变量需要数组值"
CASE 48
//Size Mismatch In Array To Object Conversion
ls_ErrMessage="数组的大小与对象的转换不匹配"
CASE 49
//Type Mismatch In Array To Object Conversion
ls_ErrMessage="数组的类型与对象的转换不匹配"
CASE 50
//Distributed Service Error
ls_ErrMessage="分布式服务错误" //PB7以上会触发一个EAServer异常
CASE 51
//Bad Argument List For Function/Event
ls_ErrMessage="函数或事件的参数不合法"
CASE 52
//Distributed Communications Error
ls_ErrMessage="分布式通讯错误" //PB7以上会触发一个EAServer异常
CASE 53
//Requested Server Not Active
ls_ErrMessage="被请求的服务器没有激活"
CASE 54
//Server Not Accepting Requests
ls_ErrMessage="服务器未接受请求"
CASE 55
//Request Terminated Abnormally
ls_ErrMessage="请求意外中断"
CASE 56
//Response To Request Incomplete
ls_ErrMessage="非完整的相应请求"
CASE 57
//Not Connected
ls_ErrMessage="未进行连接或者连接不成功"
CASE 58
//Object Instance Does Not Exist
ls_ErrMessage="对象实例不存在"
CASE 59
//Invalid Column Range
ls_ErrMessage="不合法的列范围"
CASE 60
//Invalid Row Range
ls_ErrMessage="不合法的行范围"
CASE 61
//Invalid Conversion Of Number Dimensional Array To Object
ls_ErrMessage="将任意类型数组不合法的转换成对象"
CASE 62
//Server Busy
ls_ErrMessage="服务器忙"
CASE 63
//Function/Event With No Return Value Used In Expression
ls_ErrMessage="在表达式中函数或者事件中没有返回值"
CASE 64
//Object Array Expected In Left Side Of Assignment
ls_ErrMessage="赋值语句左边需要对象数组"
CASE 65
//Dynamic Function Not Found,Possible Causes Include:Pass By Value/Reference Mismatch
ls_ErrMessage="动态函数没有找到,可能是因为值传递或者引用传递不匹配"
CASE 66
//Invalid Subscript For Array Index Operation
ls_ErrMessage="数组索引使用了非法的下标"
CASE 67
//Null Object Reference Can Not Be Assigned Or Passed To An Autoinstantiate
ls_ErrMessage="空的对象引用不能赋值或者传递给一个自动实例化对象"
CASE 68
//Null Object Reference Can Not Be Passed To External DLL Function Name
ls_ErrMessage="空的对象引用不能传递给外部动态链接库函数"
CASE 69
//Function Name Can Not Be Called From A Secured Runtime Session
ls_ErrMessage="安全实时对话模式中不能调用该函数"
CASE 70
//External DLL Function Name Can Not Be Called From A Secured Runtime Session
ls_ErrMessage="安全实时对话模式中不能调用外部动态链接库函数"
CASE 71
//General Protection Fault Occurred
ls_ErrMessage="发生一般的保护性错误"
CASE 72
//Name Failed With An Operating System Error Code Of Number
ls_ErrMessage="字段发生一个操作系统级错误"
CASE 73
//Reference Parameters Can Not Be Passed To An Asynchronous Shared/Remote Object Method
ls_ErrMessage="引用型参数不能传递给一个异步的共享或者远程对象方法"
CASE 74
//Reference Parameters Can Not Be Passed To A Shared Object Method
ls_ErrMessage="引用型参数不能传递给一个共享对象的方法"
CASE 75
//The Server Has Forced The Client To Disconnect
ls_ErrMessage="服务器已经强制客户端断开连接" //PB7以上,EAServer会触发一个异常
CASE 76
//Passing Null As A Parameter To External Function Name
ls_ErrMessage="给外部函数传递了一个空值参数"
CASE 77
//Object Passed To Shared/Remote Object Method Is Not A Nonvisual User Object
ls_ErrMessage="对象传递给共享或者远程对象的方法必须是一个不可视的用户对象"
CASE 78
//Listen Can Only Be Done In Enterprise Version Of PowerBuilder
ls_ErrMessage="监听只能在企业版的PowerBuilder中使用"
CASE 79
//The Argument To Name Must Be An Array
ls_ErrMessage="参数必须是一个数组"
CASE 80
//The Server Has Timed Out The Client Connection
ls_ErrMessage="客户端尝试连接的时间已经超出服务器设置的限制时间" //PB7以上,EAServer会触发一个异常
CASE 81
//Function Argument File Creator Must Be A Four Character String
ls_ErrMessage="函数参数文件创建者必须是一个四个字符的字符串" //只会出现在Source Control模式下
CASE 82
//Function Argument File Type Must Be A Four Character String
ls_ErrMessage="函数参数文件类型必须是一个四个字符的字符串" //只会出现在Source Control模式下
CASE 83
//Attempt To Invoke A Function Or Event That Is Not Accessible
ls_ErrMessage="试图调用一个不可存取的函数或事件"
CASE 84
//Wrong Number Of Arguments Passed To Function/Event Call
ls_ErrMessage="在函数或者事件中传递的参数个数错误"
CASE 85
//Error In Reference Argument Passed In Function/Event Call
ls_ErrMessage="在函数或者事件中传递的引用型参数错误"
CASE 86
//Ambiguous Function/Event Reference
ls_ErrMessage="引用不明确的函数或者事件"
CASE 87
//The Connection To The Server Has Been Lost
ls_ErrMessage="与服务器的连接已经丢失" //PB7以上,EAServer会触发一个异常
CASE 88
//Cannot Ask For ClassDefinition Information On Open Painter:Name
ls_ErrMessage="不能在打开的画笔中查询类定义信息"
CASE 89
//PowerBuilder 5.0 Style Proxy Objects Are Not Supported.Copy The New Style Proxy That Was Generated At Migration Time
ls_ErrMessage="5.0中的类型代理对象不支持,拷贝移植时产生的新的类型代理" //PB5和PB6的代码升级到PB7以上会发生该错误
CASE 90
//Cannot Assign Array Of Type Name To Variable Of Type Array Of Name
ls_ErrMessage="这两种数据类型的数组不能赋值"
CASE 91
//Cannot Convert Any In Any Variable To Name.Possible Cause Uninitialized Value
ls_ErrMessage="不能将任意类型变量转变成变量名所在的空间,其原因可能是变量未初始化"
CASE 92
//Required Property Name Is Missing
ls_ErrMessage="必要的属性名丢失"
CASE 93
//CORBA User Exception:Exceptionname
ls_ErrMessage="CORBA组件的调用者抛出了一个异常" //只会在EAServer中出现,一般要自己限制
CASE 94
//CORBA System Exception:Exceptionname
ls_ErrMessage="CORBA组件自身抛出了一个异常" //只会在EAServer中出现,一般要自己限制
CASE 95
//CORBA Objects May Not Be Created Locally
ls_ErrMessage="CORBA组件不能在本地创建实例" //只会在EAServer中出现,一般要自己限制
CASE 96
//Exception Thrown Has Not Been Handled
ls_ErrMessage="抛出的异常没有被处理"
CASE 97
//Cannot Save Name Because Of A Circular Reference Problem
ls_ErrMessage="不能保存一个被嵌套引用的对象" //只会出现在程序中修改PBL或者PBD的情况下
/*
Cannot save name because of a circular reference problem. Possible causes:
无法保存的原因可能是如下几种情况之一:
1.This o b j e c t references another class, which in turn references this o b j e c t.
对象引用了其他对象,被引用对象处于修改状态
2.Some other circular reference is pointing back to this o b j e c t, causing a deadlock condition.
某些其他对象正在使用此对象,产生死锁
Suggested actions:
//不翻译
1.Temporarily remove the circular reference from the referenced o b j e c t.
//不翻译
2.Make your required changes to this o b j e c t to refer to that o b j e c t.
//不翻译
3.Add back the circular reference you removed in step 1.
//不翻译
4.Perform a full rebuild (recommended).
//不翻译
*/
CASE 98
//Obsolete Object Reference
ls_ErrMessage="使用了已被废弃的函数" //例如在EAServer上使用了GetStateStatus()函数,DataWindow的DBErrorCode()和DBErrorMessage()函数
CASE 99
//Error calling method of a PBNI o b j e c t
ls_ErrMessage="错误的调用PBNI的对象函数" //只会在使用了PBNI下才会出现
CASE 100
//Error loading library containing a PBNI o b j e c t
ls_ErrMessage="PBNI对象不存在于当前指定的DLL中,无法载入"
CASE 101
//Error unloading library containing a PBNI o b j e c t
ls_ErrMessage="PBNI对象不存在于当前指定的DLL中,无法释放"
CASE 102
//Error creating a PBNI o b j e c t
ls_ErrMessage="创建PBNI对象出错" //不清楚,可能是自动实例化
CASE 103
//Error destroying a PBNI o b j e c t
ls_ErrMessage="销毁PBNI对象出错" //同上,还有可能是对象没有先执行创建操作
CASE 104
//Error calling PowerBuilder system function functionname
ls_ErrMessage="系统函数名错误" //测试不出来
CASE 105
//Executing a HALT statement in a server component is strictly forbidden
ls_ErrMessage="不要在一个服务组件中使用HALT语句"
CASE 106
//Function is reserved or not yet implemented
ls_ErrMessage="函数尚未处于执行状态"
CASE 107
//Argument is out of range
ls_ErrMessage="参数越界"
CASE 108
//Not enough memory to execute the operation
ls_ErrMessage="内存不足" //测试不出来
CASE 109
//Cannot assign a null value to array variables
ls_errMessage="无法指向一个空的数组"
CASE ELSE
//Unkown Error
ls_ErrMessage="未知错误"
END CHOOSE

ls_ErrText+="~r~n"
ls_ErrText+="系统错误日志(Error Log)"+"~r~n~r~n"
ls_ErrText+="出错时间(Error Time):"+String(Now(),"YYYY年MM月DD日 HH时MM分SS秒")+"~r~n"
ls_ErrText+="出错编号(Error Number):"+String(aerr_Info.Number)+"~r~n"
ls_ErrText+="出错对象(Error Object):"+aerr_Info.Object+"~r~n"
ls_ErrText+="出错事件(Error Event):"+aerr_Info.ObjectEvent+"~r~n"
ls_ErrText+="出错行数(Error Line):"+String(aerr_Info.Line)+"~r~n"
ls_ErrText+="出错信息(Error Text):"+ls_ErrMessage+"~r~n"

IF aerr_Info.Object<>aerr_Info.WindowMenu THEN
CHOOSE CASE Lower(Left(aerr_Info.WindowMenu,2))
CASE "m_"
ls_ErrText+="出错菜单(Error Menu):"+aerr_Info.WindowMenu+"~r~n"
CASE "w_","ws"
ls_ErrText+="出错窗口(Error Window):"+aerr_Info.WindowMenu+"~r~n"
// CASE "f_","sf"
// ls_ErrText+="出错函数(Error Function):"+aerr_Info.WindowMenu+"~r~n"
CASE ELSE
ls_ErrText+="出错控件(Error Control):"+aerr_Info.WindowMenu+"~r~n"
END CHOOSE
END IF

ls_ErrText+="详细原因(Error Message):"+aerr_Info.Text

RETURN ls_ErrText

  • 0
    点赞
  • 0
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值