How to determine what type of error an exception is in JS

problem description

A code may throw error An or error B
. The two errors are handled differently. After capture, you need to determine which error
after capturing an exception error, does error only have message, that can only match the string determination problem in message? But message should not be just for people to see, string matching is not accurate, is it?

Jun.09,2021

clipboard.png


errorerrormessage

Errormessage, filname, lineNumbermessage

clipboard.png

in addition, you can also define your own class inheritance base class, implement the fields you want, or even error type fields. However, it is not recommended.
recommends distinguishing between different types of errors.

details: https://developer.mozilla.org.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9fcca-1a8b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9fcca-1a8b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?