Skip to content

Commit 8319f3e

Browse files
committed
fix: update some things
1 parent fbe0da7 commit 8319f3e

5 files changed

Lines changed: 25 additions & 47 deletions

File tree

.yarnrc.yml

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

mise.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@ postinstall = 'npx corepack enable'
99
[settings]
1010
# This must be enabled to make the hooks work
1111
experimental = true
12+
13+
[tasks.pnpm-install]
14+
description = 'Installs dependencies with pnpm'
15+
run = 'pnpm install'
16+
sources = ['package.json', 'pnpm-lock.yaml', 'mise.toml']
17+
outputs = ['node_modules/.pnpm/lock.yaml']
18+
19+
[tasks.dev]
20+
depends = ["pnpm-install"]
21+
description = "Run the development server"
22+
run = "pnpm watch"

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
"packageManager": "pnpm@11.2.1",
1616
"scripts": {
1717
"start": "NODE_PATH=./dist node dist/server.js",
18-
"build": "yarn lint && yarn build-ts",
18+
"build": "pnpm lint && pnpm build-ts",
1919
"watch-node": "NODE_PATH=./dist nodemon dist/server.js",
2020
"watch-node:worker": "NODE_PATH=./dist nodemon dist/workers/entrypoint.js",
21-
"dev": "yarn run watch",
2221
"watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Server\" -c \"cyan.bold,green.bold\" \"pnpm watch-ts\" \"pnpm watch-node\"",
2322
"seed": "ts-node -e 'import seed from \"./test/mocks/index\";seed();'",
2423
"test": "jest --forceExit --verbose --runInBand --detectOpenHandles",

src/services/file/utils/errors.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,14 @@ export const UploadFileUnexpectedError = createError(
122122
StatusCodes.INTERNAL_SERVER_ERROR,
123123
);
124124

125-
export class DownloadFileUnexpectedError extends GraaspFileError {
126-
constructor(data?: unknown) {
127-
super(
128-
{
129-
code: 'GPFERR011',
130-
statusCode: StatusCodes.INTERNAL_SERVER_ERROR,
131-
// TODO: change message
132-
message: FAILURE_MESSAGES.DOWNLOAD_FILE_UNEXPECTED_ERROR,
133-
},
134-
data,
135-
);
136-
}
137-
}
125+
export const DownloadFileUnexpectedError = createError(
126+
'GPFERR011',
127+
FAILURE_MESSAGES.DOWNLOAD_FILE_UNEXPECTED_ERROR,
128+
StatusCodes.INTERNAL_SERVER_ERROR,
129+
);
138130

139-
export class MalformedFileConfigError extends GraaspFileError {
140-
constructor(message: string) {
141-
super({
142-
code: 'GPFERR012',
143-
statusCode: StatusCodes.INTERNAL_SERVER_ERROR,
144-
message,
145-
});
146-
}
147-
}
131+
export const MalformedFileConfigError = createError(
132+
'GPFERR012',
133+
'Malformed configuration for',
134+
StatusCodes.INTERNAL_SERVER_ERROR,
135+
);

src/services/file/utils/factory.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ import { MalformedFileConfigError } from './errors';
77

88
const verifyLocalConfig = (config?: LocalFileConfiguration) => {
99
if (!config?.storageRootPath.startsWith('/')) {
10-
throw new MalformedFileConfigError(
11-
'graasp-plugin-file: local service storageRootPath is malformed',
12-
);
10+
throw new MalformedFileConfigError('local service `storageRootPath` is malformed');
1311
}
1412

1513
if (!config?.localFilesHost) {
16-
throw new MalformedFileConfigError(
17-
'graasp-plugin-file: local service localFilesHost is not defined',
18-
);
14+
throw new MalformedFileConfigError('local service `localFilesHost` is not defined');
1915
}
2016

2117
return config;
@@ -29,7 +25,7 @@ const verifyS3Config = (config?: S3FileConfiguration) => {
2925
!config?.s3SecretAccessKey
3026
) {
3127
throw new MalformedFileConfigError(
32-
'graasp-plugin-file: mandatory options for s3 service missing',
28+
's3 service, a mandatory config is missing, check region, bucket accessKey and secretAccessKey are set',
3329
);
3430
}
3531

0 commit comments

Comments
 (0)