-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: todo items remove class extension constructor overrides
- Loading branch information
Showing
28 changed files
with
184 additions
and
147 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
packages/analytics/__tests__/errors/AnalyticsError.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AnalyticsError } from '../../src/errors/AnalyticsError'; | ||
|
||
describe('AnalyticsError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new AnalyticsError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof AnalyticsError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
AmplifyError, | ||
AmplifyErrorParams, | ||
} from '@aws-amplify/core/internals/utils'; | ||
import { AmplifyError } from '@aws-amplify/core/internals/utils'; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export class AnalyticsError extends AmplifyError { | ||
constructor(params: AmplifyErrorParams) { | ||
super(params); | ||
|
||
// Hack for making the custom error class work when transpiled to es5 | ||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = AnalyticsError; | ||
Object.setPrototypeOf(this, AnalyticsError.prototype); | ||
} | ||
} | ||
export class AnalyticsError extends AmplifyError {} |
12 changes: 12 additions & 0 deletions
12
packages/api-graphql/__tests__/utils/errors/GraphQLApiError.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { GraphQLApiError } from '../../../src/utils/errors'; | ||
|
||
describe('GraphQLApiError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new GraphQLApiError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof GraphQLApiError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
AmplifyError, | ||
AmplifyErrorParams, | ||
} from '@aws-amplify/core/internals/utils'; | ||
import { AmplifyError } from '@aws-amplify/core/internals/utils'; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export class GraphQLApiError extends AmplifyError { | ||
constructor(params: AmplifyErrorParams) { | ||
super(params); | ||
|
||
// Hack for making the custom error class work when transpiled to es5 | ||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = GraphQLApiError; | ||
Object.setPrototypeOf(this, GraphQLApiError.prototype); | ||
} | ||
} | ||
export class GraphQLApiError extends AmplifyError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { CanceledError } from '../../src/errors'; | ||
|
||
describe('CanceledError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new CanceledError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof CanceledError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { RestApiError } from '../../src/errors'; | ||
|
||
describe('RestApiError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new RestApiError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof RestApiError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,6 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { ApiError, ApiErrorParams } from '@aws-amplify/core/internals/utils'; | ||
import { ApiError } from '@aws-amplify/core/internals/utils'; | ||
|
||
export class RestApiError extends ApiError { | ||
constructor(params: ApiErrorParams) { | ||
super(params); | ||
|
||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = RestApiError; | ||
Object.setPrototypeOf(this, RestApiError.prototype); | ||
} | ||
} | ||
export class RestApiError extends ApiError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { NoUserPoolError } from '../src/Errors'; | ||
import { AuthErrorTypes } from '../src/types/Auth'; | ||
|
||
describe('NoUserPoolError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new NoUserPoolError(AuthErrorTypes.NoConfig); | ||
|
||
expect(error instanceof NoUserPoolError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AuthError } from '../../src/errors/AuthError'; | ||
|
||
describe('AuthError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new AuthError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof AuthError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
AmplifyError, | ||
AmplifyErrorParams, | ||
} from '@aws-amplify/core/internals/utils'; | ||
import { AmplifyError } from '@aws-amplify/core/internals/utils'; | ||
|
||
export class AuthError extends AmplifyError { | ||
constructor(params: AmplifyErrorParams) { | ||
super(params); | ||
|
||
// Hack for making the custom error class work when transpiled to es5 | ||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = AuthError; | ||
Object.setPrototypeOf(this, AuthError.prototype); | ||
} | ||
} | ||
export class AuthError extends AmplifyError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ApiError } from '../../src/errors/APIError'; | ||
|
||
describe('ApiError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new ApiError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof ApiError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AmplifyError } from '../../src/errors/AmplifyError'; | ||
|
||
describe('AmplifyError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new AmplifyError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof AmplifyError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/interactions/__tests__/errors/InteractionsError.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { InteractionsError } from '../../src/errors/InteractionsError'; | ||
|
||
describe('InteractionsError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new InteractionsError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof InteractionsError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
AmplifyError, | ||
AmplifyErrorParams, | ||
} from '@aws-amplify/core/internals/utils'; | ||
import { AmplifyError } from '@aws-amplify/core/internals/utils'; | ||
|
||
export class InteractionsError extends AmplifyError { | ||
constructor(params: AmplifyErrorParams) { | ||
super(params); | ||
|
||
// Hack for making the custom error class work when transpiled to es5 | ||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = InteractionsError; | ||
Object.setPrototypeOf(this, InteractionsError.prototype); | ||
} | ||
} | ||
export class InteractionsError extends AmplifyError {} |
12 changes: 12 additions & 0 deletions
12
packages/notifications/__tests__/inAppMessaging/errors/InAppMessagingError.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { InAppMessagingError } from '../../../src/inAppMessaging/errors/InAppMessagingError'; | ||
|
||
describe('InAppMessagingError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new InAppMessagingError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof InAppMessagingError).toBe(true); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/notifications/__tests__/pushNotifications/errors/PushNotificationError.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { PushNotificationError } from '../../../src/pushNotifications/errors/PushNotificationError'; | ||
|
||
describe('PushNotificationError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new PushNotificationError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof PushNotificationError).toBe(true); | ||
}); | ||
}); |
16 changes: 2 additions & 14 deletions
16
packages/notifications/src/inAppMessaging/errors/InAppMessagingError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
AmplifyError, | ||
AmplifyErrorParams, | ||
} from '@aws-amplify/core/internals/utils'; | ||
import { AmplifyError } from '@aws-amplify/core/internals/utils'; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export class InAppMessagingError extends AmplifyError { | ||
constructor(params: AmplifyErrorParams) { | ||
super(params); | ||
|
||
// Hack for making the custom error class work when transpiled to es5 | ||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = InAppMessagingError; | ||
Object.setPrototypeOf(this, InAppMessagingError.prototype); | ||
} | ||
} | ||
export class InAppMessagingError extends AmplifyError {} |
16 changes: 2 additions & 14 deletions
16
packages/notifications/src/pushNotifications/errors/PushNotificationError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
AmplifyError, | ||
AmplifyErrorParams, | ||
} from '@aws-amplify/core/internals/utils'; | ||
import { AmplifyError } from '@aws-amplify/core/internals/utils'; | ||
|
||
export class PushNotificationError extends AmplifyError { | ||
constructor(params: AmplifyErrorParams) { | ||
super(params); | ||
|
||
// Hack for making the custom error class work when transpiled to es5 | ||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = PushNotificationError; | ||
Object.setPrototypeOf(this, PushNotificationError.prototype); | ||
} | ||
} | ||
export class PushNotificationError extends AmplifyError {} |
12 changes: 12 additions & 0 deletions
12
packages/predictions/__tests__/errors/PredictionsError.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { PredictionsError } from '../../src/errors/PredictionsError'; | ||
|
||
describe('PredictionsError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new PredictionsError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof PredictionsError).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,5 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { | ||
AmplifyError, | ||
AmplifyErrorParams, | ||
} from '@aws-amplify/core/internals/utils'; | ||
import { AmplifyError } from '@aws-amplify/core/internals/utils'; | ||
|
||
export class PredictionsError extends AmplifyError { | ||
constructor(params: AmplifyErrorParams) { | ||
super(params); | ||
|
||
// TODO: Delete the following 2 lines after we change the build target to >= es2015 | ||
this.constructor = PredictionsError; | ||
Object.setPrototypeOf(this, PredictionsError.prototype); | ||
} | ||
} | ||
export class PredictionsError extends AmplifyError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { CanceledError } from '../../src/errors/CanceledError'; | ||
|
||
describe('CanceledError', () => { | ||
it('works with instanceof operator', () => { | ||
const error = new CanceledError({ | ||
name: 'TestError', | ||
message: 'message', | ||
}); | ||
|
||
expect(error instanceof CanceledError).toBe(true); | ||
}); | ||
}); |
Oops, something went wrong.