Skip to content

Commit 9a27904

Browse files
remove error package
1 parent 653c9b0 commit 9a27904

File tree

10 files changed

+17
-128
lines changed

10 files changed

+17
-128
lines changed

Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ COPY package.json yarn.lock* .yarnrc.yml ./
4242
COPY .yarn ./.yarn
4343
COPY ./packages/db ./packages/db
4444
COPY ./packages/schemas ./packages/schemas
45-
COPY ./packages/error ./packages/error
4645
COPY ./packages/shared ./packages/shared
4746

4847
RUN yarn workspace @sourcebot/db install
4948
RUN yarn workspace @sourcebot/schemas install
50-
RUN yarn workspace @sourcebot/error install
5149
RUN yarn workspace @sourcebot/shared install
5250
# ------------------------------------
5351

@@ -93,7 +91,6 @@ COPY ./packages/web ./packages/web
9391
COPY --from=shared-libs-builder /app/node_modules ./node_modules
9492
COPY --from=shared-libs-builder /app/packages/db ./packages/db
9593
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
96-
COPY --from=shared-libs-builder /app/packages/error ./packages/error
9794
COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
9895

9996
# Fixes arm64 timeouts
@@ -132,7 +129,6 @@ COPY ./packages/backend ./packages/backend
132129
COPY --from=shared-libs-builder /app/node_modules ./node_modules
133130
COPY --from=shared-libs-builder /app/packages/db ./packages/db
134131
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
135-
COPY --from=shared-libs-builder /app/packages/error ./packages/error
136132
COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
137133
RUN yarn workspace @sourcebot/backend install
138134
RUN yarn workspace @sourcebot/backend build
@@ -217,7 +213,6 @@ COPY --from=backend-builder /app/packages/backend ./packages/backend
217213
COPY --from=shared-libs-builder /app/node_modules ./node_modules
218214
COPY --from=shared-libs-builder /app/packages/db ./packages/db
219215
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
220-
COPY --from=shared-libs-builder /app/packages/error ./packages/error
221216
COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
222217

223218
# Configure dependencies

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"packages/*"
55
],
66
"scripts": {
7-
"build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces foreach -A run build",
8-
"test": "yarn workspaces foreach -A run test",
7+
"build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces foreach --all --topological run build",
8+
"test": "yarn workspaces foreach --all --topological run test",
99
"dev": "concurrently --kill-others --names \"zoekt,worker,web,mcp,schemas\" 'yarn dev:zoekt' 'yarn dev:backend' 'yarn dev:web' 'yarn watch:mcp' 'yarn watch:schemas'",
1010
"with-env": "cross-env PATH=\"$PWD/bin:$PATH\" dotenv -e .env.development -c --",
1111
"dev:zoekt": "yarn with-env zoekt-webserver -index .sourcebot/index -rpc",
@@ -18,7 +18,7 @@
1818
"dev:prisma:studio": "yarn with-env yarn workspace @sourcebot/db prisma:studio",
1919
"dev:prisma:migrate:reset": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:reset",
2020
"dev:prisma:db:push": "yarn with-env yarn workspace @sourcebot/db prisma:db:push",
21-
"build:deps": "yarn workspaces foreach -R --from '{@sourcebot/schemas,@sourcebot/error,@sourcebot/db,@sourcebot/shared}' run build"
21+
"build:deps": "yarn workspaces foreach --recursive --topological --from '{@sourcebot/schemas,@sourcebot/db,@sourcebot/shared}' run build"
2222
},
2323
"devDependencies": {
2424
"concurrently": "^9.2.1",

packages/backend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"@sentry/node": "^9.3.0",
3131
"@sentry/profiling-node": "^9.3.0",
3232
"@sourcebot/db": "workspace:*",
33-
"@sourcebot/error": "workspace:*",
3433
"@sourcebot/schemas": "workspace:*",
3534
"@sourcebot/shared": "workspace:*",
3635
"@t3-oss/env-core": "^0.12.0",

packages/backend/src/azuredevops.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { AzureDevOpsConnectionConfig } from "@sourcebot/schemas/v3/azuredevops.t
22
import { createLogger } from "@sourcebot/shared";
33
import { measure, fetchWithRetry } from "./utils.js";
44
import micromatch from "micromatch";
5-
import { BackendException, BackendError } from "@sourcebot/error";
65
import { processPromiseResults, throwIfAnyFailed } from "./connectionUtils.js";
76
import * as Sentry from "@sentry/node";
87
import * as azdev from "azure-devops-node-api";
@@ -36,9 +35,7 @@ export const getAzureDevOpsReposFromConfig = async (
3635
undefined;
3736

3837
if (!token) {
39-
const e = new BackendException(BackendError.CONNECTION_SYNC_INVALID_TOKEN, {
40-
message: 'Azure DevOps requires a Personal Access Token',
41-
});
38+
const e = new Error('Azure DevOps requires a Personal Access Token');
4239
Sentry.captureException(e);
4340
throw e;
4441
}

packages/backend/src/gerrit.ts

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import fetch from 'cross-fetch';
2-
import { GerritConnectionConfig } from "@sourcebot/schemas/v3/index.type"
1+
import { GerritConnectionConfig } from "@sourcebot/schemas/v3/index.type";
32
import { createLogger } from '@sourcebot/shared';
3+
import fetch from 'cross-fetch';
44
import micromatch from "micromatch";
5-
import { measure, fetchWithRetry } from './utils.js';
6-
import { BackendError } from '@sourcebot/error';
7-
import { BackendException } from '@sourcebot/error';
8-
import * as Sentry from "@sentry/node";
5+
import { fetchWithRetry, measure } from './utils.js';
96

107
// https://gerrit-review.googlesource.com/Documentation/rest-api.html
118
interface GerritProjects {
@@ -39,26 +36,10 @@ export const getGerritReposFromConfig = async (config: GerritConnectionConfig):
3936
const url = config.url.endsWith('/') ? config.url : `${config.url}/`;
4037

4138
let { durationMs, data: projects } = await measure(async () => {
42-
try {
43-
const fetchFn = () => fetchAllProjects(url);
44-
return fetchWithRetry(fetchFn, `projects from ${url}`, logger);
45-
} catch (err) {
46-
Sentry.captureException(err);
47-
if (err instanceof BackendException) {
48-
throw err;
49-
}
50-
51-
logger.error(`Failed to fetch projects from ${url}`, err);
52-
return null;
53-
}
39+
const fetchFn = () => fetchAllProjects(url);
40+
return fetchWithRetry(fetchFn, `projects from ${url}`, logger);
5441
});
5542

56-
if (!projects) {
57-
const e = new Error(`Failed to fetch projects from ${url}`);
58-
Sentry.captureException(e);
59-
throw e;
60-
}
61-
6243
// include repos by glob if specified in config
6344
if (config.projects) {
6445
projects = projects.filter((project) => {
@@ -91,27 +72,9 @@ const fetchAllProjects = async (url: string): Promise<GerritProject[]> => {
9172
logger.debug(`Fetching projects from Gerrit at ${endpointWithParams}`);
9273

9374
let response: Response;
94-
try {
95-
response = await fetch(endpointWithParams);
96-
if (!response.ok) {
97-
logger.error(`Failed to fetch projects from Gerrit at ${endpointWithParams} with status ${response.status}`);
98-
const e = new BackendException(BackendError.CONNECTION_SYNC_FAILED_TO_FETCH_GERRIT_PROJECTS, {
99-
status: response.status,
100-
});
101-
Sentry.captureException(e);
102-
throw e;
103-
}
104-
} catch (err) {
105-
Sentry.captureException(err);
106-
if (err instanceof BackendException) {
107-
throw err;
108-
}
109-
110-
const status = (err as any).code;
111-
logger.error(`Failed to fetch projects from Gerrit at ${endpointWithParams} with status ${status}`);
112-
throw new BackendException(BackendError.CONNECTION_SYNC_FAILED_TO_FETCH_GERRIT_PROJECTS, {
113-
status: status,
114-
});
75+
response = await fetch(endpointWithParams);
76+
if (!response.ok) {
77+
throw new Error(`Failed to fetch projects from Gerrit at ${endpointWithParams} with status ${response.status}`);
11578
}
11679

11780
const text = await response.text();
@@ -151,11 +114,11 @@ const shouldExcludeProject = ({
151114

152115
const shouldExclude = (() => {
153116
if ([
154-
'All-Projects',
155-
'All-Users',
156-
'All-Avatars',
157-
'All-Archived-Projects'
158-
].includes(project.name)) {
117+
'All-Projects',
118+
'All-Users',
119+
'All-Avatars',
120+
'All-Archived-Projects'
121+
].includes(project.name)) {
159122
reason = `Project is a special project.`;
160123
return true;
161124
}

packages/error/package.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/error/src/index.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/error/tsconfig.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/web/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
"@shopify/lang-jsonc": "^1.0.0",
9292
"@sourcebot/codemirror-lang-tcl": "^1.0.12",
9393
"@sourcebot/db": "workspace:*",
94-
"@sourcebot/error": "workspace:*",
9594
"@sourcebot/schemas": "workspace:*",
9695
"@sourcebot/shared": "workspace:*",
9796
"@ssddanbrown/codemirror-lang-twig": "^1.0.0",

yarn.lock

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7894,7 +7894,6 @@ __metadata:
78947894
"@sentry/node": "npm:^9.3.0"
78957895
"@sentry/profiling-node": "npm:^9.3.0"
78967896
"@sourcebot/db": "workspace:*"
7897-
"@sourcebot/error": "workspace:*"
78987897
"@sourcebot/schemas": "workspace:*"
78997898
"@sourcebot/shared": "workspace:*"
79007899
"@t3-oss/env-core": "npm:^0.12.0"
@@ -7959,15 +7958,6 @@ __metadata:
79597958
languageName: unknown
79607959
linkType: soft
79617960

7962-
"@sourcebot/error@workspace:*, @sourcebot/error@workspace:packages/error":
7963-
version: 0.0.0-use.local
7964-
resolution: "@sourcebot/error@workspace:packages/error"
7965-
dependencies:
7966-
"@types/node": "npm:^22.7.5"
7967-
typescript: "npm:^5.7.3"
7968-
languageName: unknown
7969-
linkType: soft
7970-
79717961
"@sourcebot/mcp@workspace:packages/mcp":
79727962
version: 0.0.0-use.local
79737963
resolution: "@sourcebot/mcp@workspace:packages/mcp"
@@ -8107,7 +8097,6 @@ __metadata:
81078097
"@shopify/lang-jsonc": "npm:^1.0.0"
81088098
"@sourcebot/codemirror-lang-tcl": "npm:^1.0.12"
81098099
"@sourcebot/db": "workspace:*"
8110-
"@sourcebot/error": "workspace:*"
81118100
"@sourcebot/schemas": "workspace:*"
81128101
"@sourcebot/shared": "workspace:*"
81138102
"@ssddanbrown/codemirror-lang-twig": "npm:^1.0.0"

0 commit comments

Comments
 (0)