When are custom exceptions in python caught?

question, such as the question, the code is as follows:

import functools
import json

class JSONOutputError(Exception):
    def __init__(self,message):
        self._message=message
    def _str__(self):
        return self._message

def json_output(decorated_=None,indent=None,sort_keys=False):
    if decorated_ and (indent or sort_keys):
        raise RuntimeError("Unexpected arguments.")
    def actual_decorator(func):
        @functools.wraps(func)
        def inner(*args,**kwargs):
            try:
                result=func(*args,**kwargs)
            except JSONOutputError as ex:
                result={
                    "status":"error",
                    "message":str(ex),
                    }
            return json.dumps(result,indent=indent,sort_keys=sort_keys)
        return inner
    if decorated_:
        return actual_decorator(decorated_)
    else:
        return actual_decorator
Under what circumstances will try in the

inner function raise JSONOutputError

Mar.04,2021

when you raise JSONOutputError in func

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