9 lines
307 B
JavaScript
9 lines
307 B
JavaScript
export const asSdkError = (error) => {
|
|
if (error instanceof Error)
|
|
return error;
|
|
if (error instanceof Object)
|
|
return Object.assign(new Error(), error);
|
|
if (typeof error === "string")
|
|
return new Error(error);
|
|
return new Error(`AWS SDK error wrapper for ${error}`);
|
|
};
|