Skip to content

Commit a06066c

Browse files
committed
Revert to using Error in the runtime export
1 parent ef0bffe commit a06066c

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

packages/backend-function/src/runtime/get_amplify_clients_configuration.test.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ void describe('getAmplifyDataClientConfig', () => {
5151

5252
await assert.rejects(
5353
async () => await getAmplifyDataClientConfig(validEnv, mockS3Client),
54-
{
55-
name: 'S3ConfigFault',
56-
message:
57-
'Error retrieving the schema from S3. Please confirm that your project has a `defineData` included in the `defineBackend` definition.',
58-
}
54+
new Error(
55+
'Error retrieving the schema from S3. Please confirm that your project has a `defineData` included in the `defineBackend` definition.'
56+
)
5957
);
6058
});
6159

@@ -72,11 +70,9 @@ void describe('getAmplifyDataClientConfig', () => {
7270

7371
await assert.rejects(
7472
async () => await getAmplifyDataClientConfig(validEnv, mockS3Client),
75-
{
76-
name: 'S3ConfigFault',
77-
message:
78-
'Error retrieving the schema from S3. You may need to grant this function authorization on the schema. TEST_ERROR: TEST_MESSAGE.',
79-
}
73+
new Error(
74+
'Error retrieving the schema from S3. You may need to grant this function authorization on the schema. TEST_ERROR: TEST_MESSAGE.'
75+
)
8076
);
8177
});
8278

packages/backend-function/src/runtime/get_amplify_clients_configuration.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
S3Client,
55
S3ServiceException,
66
} from '@aws-sdk/client-s3';
7-
import { AmplifyFault } from '@aws-amplify/platform-core';
87

98
export type DataClientEnv = {
109
/* eslint-disable @typescript-eslint/naming-convention */
@@ -139,14 +138,13 @@ export const getAmplifyDataClientConfig = async <T>(
139138
modelIntrospectionSchema = JSON.parse(modelIntrospectionSchemaJson ?? '{}');
140139
} catch (caught) {
141140
if (caught instanceof NoSuchKey) {
142-
throw new AmplifyFault('S3ConfigFault', {
143-
message:
144-
'Error retrieving the schema from S3. Please confirm that your project has a `defineData` included in the `defineBackend` definition.',
145-
});
141+
throw new Error(
142+
'Error retrieving the schema from S3. Please confirm that your project has a `defineData` included in the `defineBackend` definition.'
143+
);
146144
} else if (caught instanceof S3ServiceException) {
147-
throw new AmplifyFault('S3ConfigFault', {
148-
message: `Error retrieving the schema from S3. You may need to grant this function authorization on the schema. ${caught.name}: ${caught.message}.`,
149-
});
145+
throw new Error(
146+
`Error retrieving the schema from S3. You may need to grant this function authorization on the schema. ${caught.name}: ${caught.message}.`
147+
);
150148
} else {
151149
throw caught;
152150
}

0 commit comments

Comments
 (0)