1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | var __extends = (this && this.__extends) || (function () {
|
15 | var extendStatics = function (d, b) {
|
16 | extendStatics = Object.setPrototypeOf ||
|
17 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
18 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
19 | return extendStatics(d, b);
|
20 | };
|
21 | return function (d, b) {
|
22 | extendStatics(d, b);
|
23 | function __() { this.constructor = d; }
|
24 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25 | };
|
26 | })();
|
27 | Object.defineProperty(exports, "__esModule", { value: true });
|
28 | var core_1 = require("@aws-amplify/core");
|
29 | var AuthErrorStrings_1 = require("./common/AuthErrorStrings");
|
30 | var logger = new core_1.ConsoleLogger('AuthError');
|
31 | var AuthError = (function (_super) {
|
32 | __extends(AuthError, _super);
|
33 | function AuthError(type) {
|
34 | var _this = this;
|
35 | var _a = exports.authErrorMessages[type], message = _a.message, log = _a.log;
|
36 | _this = _super.call(this, message) || this;
|
37 |
|
38 |
|
39 | _this.constructor = AuthError;
|
40 | Object.setPrototypeOf(_this, AuthError.prototype);
|
41 | _this.name = 'AuthError';
|
42 | _this.log = log || message;
|
43 | logger.error(_this.log);
|
44 | return _this;
|
45 | }
|
46 | return AuthError;
|
47 | }(Error));
|
48 | exports.AuthError = AuthError;
|
49 | var NoUserPoolError = (function (_super) {
|
50 | __extends(NoUserPoolError, _super);
|
51 | function NoUserPoolError(type) {
|
52 | var _this = _super.call(this, type) || this;
|
53 |
|
54 |
|
55 | _this.constructor = NoUserPoolError;
|
56 | Object.setPrototypeOf(_this, NoUserPoolError.prototype);
|
57 | _this.name = 'NoUserPoolError';
|
58 | return _this;
|
59 | }
|
60 | return NoUserPoolError;
|
61 | }(AuthError));
|
62 | exports.NoUserPoolError = NoUserPoolError;
|
63 | exports.authErrorMessages = {
|
64 | noConfig: {
|
65 | message: AuthErrorStrings_1.AuthErrorStrings.DEFAULT_MSG,
|
66 | log: "\n Error: Amplify has not been configured correctly.\n This error is typically caused by one of the following scenarios:\n\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n \n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\n\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n ",
|
67 | },
|
68 | missingAuthConfig: {
|
69 | message: AuthErrorStrings_1.AuthErrorStrings.DEFAULT_MSG,
|
70 | log: "\n Error: Amplify has not been configured correctly. \n The configuration object is missing required auth properties.\n This error is typically caused by one of the following scenarios:\n\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n ",
|
71 | },
|
72 | emptyUsername: {
|
73 | message: AuthErrorStrings_1.AuthErrorStrings.EMPTY_USERNAME,
|
74 | },
|
75 |
|
76 | invalidUsername: {
|
77 | message: AuthErrorStrings_1.AuthErrorStrings.INVALID_USERNAME,
|
78 | },
|
79 | emptyPassword: {
|
80 | message: AuthErrorStrings_1.AuthErrorStrings.EMPTY_PASSWORD,
|
81 | },
|
82 | emptyCode: {
|
83 | message: AuthErrorStrings_1.AuthErrorStrings.EMPTY_CODE,
|
84 | },
|
85 | signUpError: {
|
86 | message: AuthErrorStrings_1.AuthErrorStrings.SIGN_UP_ERROR,
|
87 | log: 'The first parameter should either be non-null string or object',
|
88 | },
|
89 | noMFA: {
|
90 | message: AuthErrorStrings_1.AuthErrorStrings.NO_MFA,
|
91 | },
|
92 | invalidMFA: {
|
93 | message: AuthErrorStrings_1.AuthErrorStrings.INVALID_MFA,
|
94 | },
|
95 | emptyChallengeResponse: {
|
96 | message: AuthErrorStrings_1.AuthErrorStrings.EMPTY_CHALLENGE,
|
97 | },
|
98 | noUserSession: {
|
99 | message: AuthErrorStrings_1.AuthErrorStrings.NO_USER_SESSION,
|
100 | },
|
101 | deviceConfig: {
|
102 | message: AuthErrorStrings_1.AuthErrorStrings.DEVICE_CONFIG,
|
103 | },
|
104 | networkError: {
|
105 | message: AuthErrorStrings_1.AuthErrorStrings.NETWORK_ERROR,
|
106 | },
|
107 | default: {
|
108 | message: AuthErrorStrings_1.AuthErrorStrings.DEFAULT_MSG,
|
109 | },
|
110 | };
|
111 |
|
\ | No newline at end of file |