Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/accounts/errors/src/app-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ export class AppError extends Error {
}
return new AppError(
{
code: 503,
code: 403,
error: 'Feature not enabled',
errno: ERRNO.FEATURE_NOT_ENABLED,
message: 'Feature not enabled',
Expand Down
10 changes: 10 additions & 0 deletions libs/accounts/errors/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ describe('AppErrors', () => {
}
);

it('featureNotEnabled', () => {
const result = AppError.featureNotEnabled();
expect(result).toBeInstanceOf(AppError);
expect(result.errno).toEqual(202);
expect(result.message).toEqual('Feature not enabled');
expect(result.output.statusCode).toEqual(403);
expect(result.output.payload.error).toEqual('Feature not enabled');
expect(result.output.payload.errno).toEqual(202);
});

it('iapInvalidToken', () => {
const defaultErrorMessage = 'Invalid IAP token';
let result = AppError.iapInvalidToken();
Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-auth-server/docs/swagger/auth-server-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const AUTH_SERVER_API_DESCRIPTION = {
| 404 | 198 | Unknown app name |
| 400 | 199 | Invalid promotion code |
| 503 | 201 | Service unavailable |
| 503 | 202 | Feature not enabled |
| 403 | 202 | Feature not enabled |
| 500 | 203 | System unavailable, try again soon |
| 503 | 204 | This client has been temporarily disabled |
| 500 | 205 | Could not login with third party account, please try again later |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const ACCOUNT_DEVICE_POST = {
- \`errno: 107\` - Invalid parameter in request body
`,
},
503: {
403: {
description: dedent`
Failing requests may be caused by the following errors (this is not an exhaustive list):
- \`errno: 202\` - Feature not enabled
Expand Down Expand Up @@ -159,7 +159,7 @@ const ACCOUNT_DEVICES_NOTIFY_POST = {
- \`errno: 107\` - Invalid parameter in request body
`,
},
503: {
403: {
description: dedent`
Failing requests may be caused by the following errors (this is not an exhaustive list):
- \`errno: 202\` - Feature not enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ describe('/account/device', () => {
throw new Error('should have thrown');
},
(err: any) => {
expect(err.output.statusCode).toBe(503);
expect(err.output.statusCode).toBe(403);
expect(err.errno).toBe(error.ERRNO.FEATURE_NOT_ENABLED);
}
);
Expand Down Expand Up @@ -504,7 +504,7 @@ describe('/account/devices/notify', () => {
throw new Error('should have thrown');
},
(err: any) => {
expect(err.output.statusCode).toBe(503);
expect(err.output.statusCode).toBe(403);
expect(err.errno).toBe(error.ERRNO.FEATURE_NOT_ENABLED);
}
);
Expand Down Expand Up @@ -821,7 +821,7 @@ describe('/account/device/commands', () => {
mockRequest.auth.credentials.refreshTokenId = 'aaabbbccc';

await expect(route.handler(mockRequest)).rejects.toMatchObject({
output: { statusCode: 503 },
output: { statusCode: 403 },
errno: error.ERRNO.FEATURE_NOT_ENABLED,
});
expect(mockPushbox.retrieve).not.toHaveBeenCalled();
Expand Down Expand Up @@ -1310,7 +1310,7 @@ describe('/account/devices/invoke_command', () => {
mockRequest.auth.credentials.refreshTokenId = 'aaabbbccc';

await expect(route.handler(mockRequest)).rejects.toMatchObject({
output: { statusCode: 503 },
output: { statusCode: 403 },
errno: error.ERRNO.FEATURE_NOT_ENABLED,
});
expect(mockPushbox.store).not.toHaveBeenCalled();
Expand Down Expand Up @@ -1673,7 +1673,7 @@ describe('/account/devices', () => {
});

await expect(route.handler(mockRequest)).rejects.toMatchObject({
output: { statusCode: 503 },
output: { statusCode: 403 },
errno: error.ERRNO.FEATURE_NOT_ENABLED,
});
});
Expand Down
Loading