Skip to content

Commit d63f3cf

Browse files
chore(web): Improve error messages for file loading errors (#665)
1 parent 3d85a05 commit d63f3cf

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Added
1414
- Added support for arbitrary user IDs required for OpenShift. [#658](https://github.com/sourcebot-dev/sourcebot/pull/658)
1515

16+
### Updated
17+
- Improved error messages in file source api. [#665](https://github.com/sourcebot-dev/sourcebot/pull/665)
18+
1619
## [4.10.2] - 2025-12-04
1720

1821
### Fixed

packages/web/src/actions.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ const auditService = getAuditService();
3838
/**
3939
* "Service Error Wrapper".
4040
*
41-
* Captures any thrown exceptions and converts them to a unexpected
42-
* service error. Also logs them with Sentry.
41+
* Captures any thrown exceptions, logs them to the console and Sentry,
42+
* and returns a generic unexpected service error.
4343
*/
4444
export const sew = async <T>(fn: () => Promise<T>): Promise<T | ServiceError> => {
4545
try {
@@ -52,10 +52,6 @@ export const sew = async <T>(fn: () => Promise<T>): Promise<T | ServiceError> =>
5252
return e.serviceError;
5353
}
5454

55-
if (e instanceof Error) {
56-
return unexpectedError(e.message);
57-
}
58-
5955
return unexpectedError(`An unexpected error occurred. Please try again later.`);
6056
}
6157
}

packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ export const CodePreviewPanel = async ({ path, repoName, revisionName }: CodePre
2222
getRepoInfoByName(repoName),
2323
]);
2424

25-
if (isServiceError(fileSourceResponse) || isServiceError(repoInfoResponse)) {
26-
return <div>Error loading file source</div>
25+
if (isServiceError(fileSourceResponse)) {
26+
return <div>Error loading file source: {fileSourceResponse.message}</div>
27+
}
28+
29+
if (isServiceError(repoInfoResponse)) {
30+
return <div>Error loading repo info: {repoInfoResponse.message}</div>
2731
}
2832

2933
const codeHostInfo = getCodeHostInfoForRepo({

0 commit comments

Comments
 (0)