Skip to content

Commit 1ecf9ac

Browse files
committed
fix: update AssertionError usage in examples for consistency
1 parent 975679d commit 1ecf9ac

File tree

1 file changed

+5
-3
lines changed
  • packages/event-handler/src/appsync-graphql

1 file changed

+5
-3
lines changed

packages/event-handler/src/appsync-graphql/Router.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@ class Router {
967967
* @example
968968
* ```ts
969969
* import { AppSyncGraphQLResolver } from '@aws-lambda-powertools/event-handler/appsync-graphql';
970+
* import { AssertionError } from 'assert';
970971
*
971972
* const app = new AppSyncGraphQLResolver();
972973
*
@@ -980,7 +981,7 @@ class Router {
980981
*
981982
* // Register a resolver that might throw an AssertionError
982983
* app.onQuery('getTodo', async () => {
983-
* throw new AssertionError('Something went wrong');
984+
* throw new AssertionError();
984985
* });
985986
*
986987
* export const handler = async (event, context) =>
@@ -992,12 +993,13 @@ class Router {
992993
* @example
993994
* ```ts
994995
* import { AppSyncGraphQLResolver } from '@aws-lambda-powertools/event-handler/appsync-graphql';
996+
* import { AssertionError } from 'assert';
995997
*
996998
* const app = new AppSyncGraphQLResolver();
997999
*
9981000
* class Lambda {
9991001
* ⁣@app.exceptionHandler(AssertionError)
1000-
* async handleAssertionError(error) {
1002+
* async handleAssertionError(error: AssertionError) {
10011003
* return {
10021004
* message: 'Assertion failed',
10031005
* details: error.message
@@ -1006,7 +1008,7 @@ class Router {
10061008
*
10071009
* ⁣@app.onQuery('getUser')
10081010
* async getUser() {
1009-
* throw new AssertionError('Something went wrong');
1011+
* throw new AssertionError();
10101012
* }
10111013
*
10121014
* async handler(event, context) {

0 commit comments

Comments
 (0)