mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
feat: add authentication expiration handling for Notion tools
- Implemented checks for expired authentication in the Notion page creation and deletion tools, returning appropriate error messages for re-authentication. - Updated the Notion tool metadata service to track account health and persist authentication status, improving error handling and user feedback during operations.
This commit is contained in:
parent
db5fddb104
commit
10af5d3f3e
3 changed files with 42 additions and 2 deletions
|
|
@ -95,8 +95,19 @@ def create_delete_notion_page_tool(
|
|||
"message": error_msg,
|
||||
}
|
||||
|
||||
account = context.get("account", {})
|
||||
if account.get("auth_expired"):
|
||||
logger.warning(
|
||||
"Notion account %s has expired authentication",
|
||||
account.get("id"),
|
||||
)
|
||||
return {
|
||||
"status": "auth_error",
|
||||
"message": "The Notion account for this page needs re-authentication. Please re-authenticate in your connector settings.",
|
||||
}
|
||||
|
||||
page_id = context.get("page_id")
|
||||
connector_id_from_context = context.get("account", {}).get("id")
|
||||
connector_id_from_context = account.get("id")
|
||||
document_id = context.get("document_id")
|
||||
|
||||
logger.info(
|
||||
|
|
|
|||
|
|
@ -110,6 +110,17 @@ def create_update_notion_page_tool(
|
|||
"message": error_msg,
|
||||
}
|
||||
|
||||
account = context.get("account", {})
|
||||
if account.get("auth_expired"):
|
||||
logger.warning(
|
||||
"Notion account %s has expired authentication",
|
||||
account.get("id"),
|
||||
)
|
||||
return {
|
||||
"status": "auth_error",
|
||||
"message": "The Notion account for this page needs re-authentication. Please re-authenticate in your connector settings.",
|
||||
}
|
||||
|
||||
page_id = context.get("page_id")
|
||||
document_id = context.get("document_id")
|
||||
connector_id_from_context = context.get("account", {}).get("id")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue