wrap aws-sdk errors - (prettier update)

there are http errors with no message from aws-sdk, so the error
 is wrapped to conform to the @backstage/errors assertError checks

Signed-off-by: Manuel Stein <manuel.stein@nokia-bell-labs.com>
This commit is contained in:
Manuel Stein
2022-07-23 18:34:57 +03:00
parent c8196bd37d
commit 6c118dd093
2 changed files with 4 additions and 2 deletions
@@ -49,7 +49,9 @@ const streamToBuffer = (stream: Readable): Promise<Buffer> => {
try {
const chunks: any[] = [];
stream.on('data', chunk => chunks.push(chunk));
stream.on('error', (e: Error) => reject(new ForwardedError('Unable to read stream', e)));
stream.on('error', (e: Error) =>
reject(new ForwardedError('Unable to read stream', e)),
);
stream.on('end', () => resolve(Buffer.concat(chunks)));
} catch (e) {
throw new ForwardedError('Unable to parse the response data', e);