PHP Exception အ ကိုးအကား
PHP Exception Object
ခြွင်းချက်များအား အမှားအယွင်းများနှင့် မမျှော်လင့်ထားသော အပြုအမူများအကြောင်း အချက်အလက်ပေးပို့ရန် လုပ်ဆောင်ချက်များနှင့် နည်းလမ်းများဖြင့် အသုံးပြုပါသည်။
ခြွင်းချက် အရာဝတ္တုတွင် အများသူငှာ ဂုဏ်သတ္တိများ မပါရှိသော်လည်း တည်ဆောက်သူနှင့် နည်းလမ်းများကို အသုံးပြု၍ ရေးသားခြင်း သို့မဟုတ် ဖတ်ခြင်းမှ ရေးသားခြင်း သို့မဟုတ် ဖတ်နိုင်သော သီးသန့်နှင့် ကာကွယ်ထားသော ဂုဏ်သတ္တိများ ပါရှိသည်။
Exception object တွင် အောက်ပါနည်းလမ်းများ ပါရှိသည်။
Method | Description |
---|---|
Exception() | The contructor 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 |