code: def _catch_error(
      err_name: Literal["NotFittedError", "ThresholdNotInferredError"]
  ) -> Callable:
      """Decorator to catch errors and raise a more informative error message.
  
      Note: This decorator should only be used on detector frontend methods. It catches errors raised by
      backend components and re-raises them with error messages corresponding to the specific detector frontend.
      This is done to avoid exposing the backend components to the user.
      """
      error_type = globals()[err_name]
  
      def decorate(f):
          @wraps(f)
          def applicator(self, *args, **kwargs):
              try:
                  return f(self, *args, **kwargs)
              except error_type as err:
                  raise error_type(self.__class__.__name__) from err
  
          return applicator
  
      return decorate
  
file_path: alibi-detect/alibi_detect/exceptions.py
imports: from typing_extensions import Literal
  from typing import Callable
  from abc import ABC
  from functools import wraps
label_desc: Use image node_id 1 for calling a global function with example usage: _catch_error(err_name) and returns: decorate, applicator, f