From ee5de69e374aabf5631da18a5bbc1c285ee6f7a1 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 29 Jun 2026 05:46:55 -0500 Subject: [PATCH] refac --- backend/open_webui/utils/errors.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 backend/open_webui/utils/errors.py diff --git a/backend/open_webui/utils/errors.py b/backend/open_webui/utils/errors.py deleted file mode 100644 index 89dcc2aa08..0000000000 --- a/backend/open_webui/utils/errors.py +++ /dev/null @@ -1,25 +0,0 @@ -import errno - -from fastapi import HTTPException - -from open_webui.constants import ERROR_MESSAGES - - -OS_ERROR_MESSAGES = { - errno.ENAMETOOLONG: 'File name is too long.', - errno.ENOSPC: 'The server is out of storage space.', - errno.EDQUOT: 'Server storage quota exceeded.', - errno.EACCES: 'Server storage is not writable.', - errno.EPERM: 'Server storage is not writable.', - errno.EROFS: 'Server storage is not writable.', -} - - -def error_detail(exc: Exception, fallback: str = '') -> str: - if isinstance(exc, HTTPException) and exc.detail: - return exc.detail if isinstance(exc.detail, str) else ERROR_MESSAGES.DEFAULT(fallback) - - if isinstance(exc, OSError) and exc.errno in OS_ERROR_MESSAGES: - return ERROR_MESSAGES.DEFAULT(OS_ERROR_MESSAGES[exc.errno]) - - return ERROR_MESSAGES.DEFAULT(fallback)