Harsh Upadhyay
adding backend to spaces with initial commit.
8397f09
raw
history blame contribute delete
408 Bytes
import functools
from flask import jsonify
import logging
def handle_errors(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as e:
logging.exception(f"Unhandled exception in {func.__name__}")
return jsonify({"success": False, "error": "Internal server error"}), 500
return wrapper