diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f126fb..efa2c1cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for arbitrary user IDs required for OpenShift. [#658](https://github.com/sourcebot-dev/sourcebot/pull/658) +### Updated +- Improved error messages in file source api. [#665](https://github.com/sourcebot-dev/sourcebot/pull/665) + ## [4.10.2] - 2025-12-04 ### Fixed diff --git a/packages/web/src/actions.ts b/packages/web/src/actions.ts index cc239fa9..056a5fd6 100644 --- a/packages/web/src/actions.ts +++ b/packages/web/src/actions.ts @@ -38,8 +38,8 @@ const auditService = getAuditService(); /** * "Service Error Wrapper". * - * Captures any thrown exceptions and converts them to a unexpected - * service error. Also logs them with Sentry. + * Captures any thrown exceptions, logs them to the console and Sentry, + * and returns a generic unexpected service error. */ export const sew = async (fn: () => Promise): Promise => { try { @@ -52,10 +52,6 @@ export const sew = async (fn: () => Promise): Promise => return e.serviceError; } - if (e instanceof Error) { - return unexpectedError(e.message); - } - return unexpectedError(`An unexpected error occurred. Please try again later.`); } } diff --git a/packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx b/packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx index 7fc2af07..b932cd47 100644 --- a/packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx +++ b/packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx @@ -22,8 +22,12 @@ export const CodePreviewPanel = async ({ path, repoName, revisionName }: CodePre getRepoInfoByName(repoName), ]); - if (isServiceError(fileSourceResponse) || isServiceError(repoInfoResponse)) { - return
Error loading file source
+ if (isServiceError(fileSourceResponse)) { + return
Error loading file source: {fileSourceResponse.message}
+ } + + if (isServiceError(repoInfoResponse)) { + return
Error loading repo info: {repoInfoResponse.message}
} const codeHostInfo = getCodeHostInfoForRepo({