code: def handle_errors(f):
      
      import traceback
      from plone.jsonapi.core.helpers import error
  
      def decorator(*args, **kwargs):
          try:
              return f(*args, **kwargs)
          except Exception:
              var = traceback.format_exc()
              return error(var)
  
      return decorator
docs: simple JSON error handler