Skip to content

Commit

Permalink
fix(api/ops_trace): avoid raise exception directly (#11732)
Browse files Browse the repository at this point in the history
Signed-off-by: -LAN- <laipz8200@outlook.com>
  • Loading branch information
laipz8200 authored Dec 17, 2024
1 parent 7b7eb00 commit 259cff9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/controllers/console/app/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def post(self, app_model):
provider_type=agent_tool_entity.provider_type,
identity_id=f"AGENT.{app_model.id}",
)
except Exception as e:
except Exception:
continue

# get decrypted parameters
Expand Down Expand Up @@ -97,7 +97,7 @@ def post(self, app_model):
app_id=app_model.id,
agent_tool=agent_tool_entity,
)
except Exception as e:
except Exception:
continue

manager = ToolParameterConfigurationManager(
Expand Down
9 changes: 5 additions & 4 deletions api/controllers/console/app/ops_trace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask_restful import Resource, reqparse
from werkzeug.exceptions import BadRequest

from controllers.console import api
from controllers.console.app.error import TracingConfigCheckError, TracingConfigIsExist, TracingConfigNotExist
Expand Down Expand Up @@ -26,7 +27,7 @@ def get(self, app_id):
return {"has_not_configured": True}
return trace_config
except Exception as e:
raise e
raise BadRequest(str(e))

@setup_required
@login_required
Expand All @@ -48,7 +49,7 @@ def post(self, app_id):
raise TracingConfigCheckError()
return result
except Exception as e:
raise e
raise BadRequest(str(e))

@setup_required
@login_required
Expand All @@ -68,7 +69,7 @@ def patch(self, app_id):
raise TracingConfigNotExist()
return {"result": "success"}
except Exception as e:
raise e
raise BadRequest(str(e))

@setup_required
@login_required
Expand All @@ -85,7 +86,7 @@ def delete(self, app_id):
raise TracingConfigNotExist()
return {"result": "success"}
except Exception as e:
raise e
raise BadRequest(str(e))


api.add_resource(TraceAppConfigApi, "/apps/<uuid:app_id>/trace-config")
2 changes: 1 addition & 1 deletion api/controllers/console/datasets/datasets_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def post(self, dataset_id):
if document.indexing_status == "completed":
raise DocumentAlreadyFinishedError()
retry_documents.append(document)
except Exception as e:
except Exception:
logging.exception(f"Failed to retry document, document id: {document_id}")
continue
# retry document
Expand Down

0 comments on commit 259cff9

Please sign in to comment.