Custom exception class that uses instanceof to determine type errors

defines a class BusinessRunTimeException, that inherits RuntimeException. When captured by controller, the result of e instanceof BusinessRunTimeException judgment is returned to false

.

related codes

Business layer throws an exception directly:

  throw new BusinessRunTimeException();

Control layer capture:

    try {
             //
        } catch (Exception e) {
            if (e instanceof BusinessRunTimeException) {
                BusinessRunTimeException b = (BusinessRunTimeException) e;
                //
            } else {
               //
            }
          }
Aug.23,2021

e e.getCause() instanceof

according to the test, there should be a layer of package in some location


WTF, so the question is?


because it is a dubbo project, it handles the exception itself. For more information, please see https://blog.csdn.net/XLee190.

.
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-1b3e9a7-4146a.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-1b3e9a7-4146a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?