Skip to content

Commit 856c789

Browse files
authored
Merge pull request #1 from bcgov/feat/skipUploadOnError
Upload error handling
2 parents e34081c + 008e7a7 commit 856c789

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"build": "tsc -p .",
88
"build:live": "nodemon --watch 'src/**/*.ts' --exec \"ts-node\" src/index.ts",
9-
"lint": "eslint \"{src,apps,libs,test}/**/*.mjs\" --fix",
9+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
1010
"start": "npm run build:live",
1111
"test": "echo \"Error: no test specified\" && exit 1"
1212
},

src/cron/backup.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,18 @@ async function backupWithSecret(
9191
const client = getClient(secret);
9292
const files = [];
9393
for (const row of dbResult.rows) {
94-
client.fPutObject(OBJECT_STORAGE_BUCKET, path.basename(row.path), row.path);
94+
try {
95+
const response = await client.fPutObject(
96+
OBJECT_STORAGE_BUCKET,
97+
path.basename(row.path),
98+
row.path,
99+
);
100+
console.log(response);
101+
} catch (err) {
102+
const info = { file: row.path, message: err };
103+
console.log(info);
104+
continue;
105+
}
95106
db.query<{
96107
id: number;
97108
basename: string;

0 commit comments

Comments
 (0)