函数和方法使用异常来发送有关错误和意外行为的信息。
Exception 对象没有公共属性,但它具有私有和受保护的属性,可以使用构造函数和方法写入或读取这些属性。
Exception对象有以下方法:
Method | Description |
---|---|
Exception() | The constructor of the Exception object |
getCode() | Returns the exception code |
getFile() | Returns the full path of the file in which the exception was thrown |
getMessage() | Returns a string describing why the exception was thrown |
getLine() | Returns the line number of the line of code which threw the exception |
getPrevious() | If this exception was triggered by another one, this method returns the previous exception. If not, then it returns null |
getTrace() | Returns an array with information about all of the functions that were running at the time the exception was thrown |
getTraceAsString() | Returns the same information as getTrace(), but in a string |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!