mongoengine.NotUniqueError
from mongoengine.errors import NotUniqueError try: pass # 保存字段到数据库 result = formalReturn(201, 'upload success', data=None) return jsonify(result), 201 except NotUniqueError as e: result = formalReturn(40001, 'file already exists', data=str(e)) except Exception as e: result = formalReturn(40004, 'unexpected error', data=str(e))