From 1b7c4847dc66a3eb9247fff10a862c956da03bb5 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Wed, 14 Oct 2020 16:48:27 +0200 Subject: [PATCH] Add s3 error output --- registry/src/deps.ts | 1 + registry/src/http/api.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/registry/src/deps.ts b/registry/src/deps.ts index 6a48149..ee1405d 100644 --- a/registry/src/deps.ts +++ b/registry/src/deps.ts @@ -1,4 +1,5 @@ export * as S3 from "https://deno.land/x/s3@0.2.0/mod.ts"; +export { S3Error } from "https://deno.land/x/s3@0.2.0/src/error.ts"; export * as Ini from "https://deno.hibas123.de/raw/ini@0.0.1/mod.ts"; diff --git a/registry/src/http/api.ts b/registry/src/http/api.ts index 3f8e161..56ea7a3 100644 --- a/registry/src/http/api.ts +++ b/registry/src/http/api.ts @@ -1,4 +1,4 @@ -import { ABC, Path, Compress, FS, Colors } from "../deps.ts"; +import { ABC, Path, Compress, FS, Colors, S3Error } from "../deps.ts"; import bucket from "../s3.ts"; import { isValidPackageName, basicauth, isValidFullVersion } from "../utils.ts"; @@ -145,7 +145,7 @@ async function uploadPackage(ctx: ABC.Context) { const bucketPath = (bucketBase + relative).replace(/@/g, "ยง"); const body = await Deno.readAll(await Deno.open(file.path)); - console.log("Put Object", bucketPath); + console.log("Put Object", bucketPath, body.byteLength); await bucket.putObject(bucketPath, body, {}); } console.log("Setting new live version"); @@ -171,6 +171,7 @@ async function uploadPackage(ctx: ABC.Context) { Colors.red("Error while processing newly uploaded package") ); console.error(err); + if (err instanceof S3Error) console.log(err.response); return { success: false, message: err.message,