@aws-amplify/auth
Version:
Auth category of aws-amplify
20 lines (17 loc) • 618 B
JavaScript
import { AmplifyErrorCode } from '@aws-amplify/core/internals/utils';
import { AuthError } from '../AuthError.mjs';
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
function assertServiceError(error) {
if (!error ||
error.name === 'Error' ||
error instanceof TypeError) {
throw new AuthError({
name: AmplifyErrorCode.Unknown,
message: 'An unknown error has occurred.',
underlyingError: error,
});
}
}
export { assertServiceError };
//# sourceMappingURL=assertServiceError.mjs.map