@vardario/cognito-client 4.0.2 → 4.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/error.d.ts CHANGED
@@ -362,8 +362,11 @@ export declare enum RevokeTokenException {
362
362
  UnsupportedOperationException = "UnsupportedOperationException",
363
363
  UnsupportedTokenTypeException = "UnsupportedTokenTypeException"
364
364
  }
365
+ export type CognitoErrorType = 'CommonError' | 'InitAuthError' | 'RespondToAuthChallengeError' | 'SignUpError' | 'ConfirmSignUpError' | 'ChangePasswordError' | 'RevokeTokenError' | 'ForgotPasswordError' | 'ConfirmForgotPasswordError' | 'ResendConfirmationCodeError' | 'UpdateUserAttributesError' | 'VerifyUserAttributeError' | 'GlobalSignOutError';
365
366
  export declare class CognitoError extends Error {
366
- constructor(message: string);
367
+ readonly errorType: CognitoErrorType;
368
+ readonly cognitoException: CommonException | InitiateAuthException | RespondToAuthChallengeException | SignUpException | ConfirmSignUpException | ChangePasswordException | RevokeTokenException | ForgotPasswordException | ConfirmForgotPasswordException | ResendConfirmationException | UpdateUserAttributesException | VerifyUserAttributeException | GlobalSignOutException;
369
+ constructor(message: string, errorType: CognitoErrorType, cognitoException: CommonException | InitiateAuthException | RespondToAuthChallengeException | SignUpException | ConfirmSignUpException | ChangePasswordException | RevokeTokenException | ForgotPasswordException | ConfirmForgotPasswordException | ResendConfirmationException | UpdateUserAttributesException | VerifyUserAttributeException | GlobalSignOutException);
367
370
  }
368
371
  export declare class CommonError extends CognitoError {
369
372
  readonly cognitoException: CommonException;
package/lib/error.js CHANGED
@@ -401,85 +401,87 @@ export var RevokeTokenException;
401
401
  RevokeTokenException["UnsupportedTokenTypeException"] = "UnsupportedTokenTypeException";
402
402
  })(RevokeTokenException || (RevokeTokenException = {}));
403
403
  export class CognitoError extends Error {
404
- constructor(message) {
404
+ constructor(message, errorType, cognitoException) {
405
405
  super(message);
406
+ this.errorType = errorType;
407
+ this.cognitoException = cognitoException;
406
408
  }
407
409
  }
408
410
  export class CommonError extends CognitoError {
409
411
  constructor(message, cognitoException) {
410
- super(message);
412
+ super(message, 'CommonError', cognitoException);
411
413
  this.cognitoException = cognitoException;
412
414
  }
413
415
  }
414
416
  export class InitAuthError extends CognitoError {
415
417
  constructor(message, cognitoException) {
416
- super(message);
418
+ super(message, 'InitAuthError', cognitoException);
417
419
  this.cognitoException = cognitoException;
418
420
  }
419
421
  }
420
422
  export class RespondToAuthChallengeError extends CognitoError {
421
423
  constructor(message, cognitoException) {
422
- super(message);
424
+ super(message, 'RespondToAuthChallengeError', cognitoException);
423
425
  this.cognitoException = cognitoException;
424
426
  }
425
427
  }
426
428
  export class SignUpError extends CognitoError {
427
429
  constructor(message, cognitoException) {
428
- super(message);
430
+ super(message, 'SignUpError', cognitoException);
429
431
  this.cognitoException = cognitoException;
430
432
  }
431
433
  }
432
434
  export class ConfirmSignUpError extends CognitoError {
433
435
  constructor(message, cognitoException) {
434
- super(message);
436
+ super(message, 'ConfirmSignUpError', cognitoException);
435
437
  this.cognitoException = cognitoException;
436
438
  }
437
439
  }
438
440
  export class ChangePasswordError extends CognitoError {
439
441
  constructor(message, cognitoException) {
440
- super(message);
442
+ super(message, 'ChangePasswordError', cognitoException);
441
443
  this.cognitoException = cognitoException;
442
444
  }
443
445
  }
444
446
  export class RevokeTokenError extends CognitoError {
445
447
  constructor(message, cognitoException) {
446
- super(message);
448
+ super(message, 'RevokeTokenError', cognitoException);
447
449
  this.cognitoException = cognitoException;
448
450
  }
449
451
  }
450
452
  export class ForgotPasswordError extends CognitoError {
451
453
  constructor(message, cognitoException) {
452
- super(message);
454
+ super(message, 'ForgotPasswordError', cognitoException);
453
455
  this.cognitoException = cognitoException;
454
456
  }
455
457
  }
456
458
  export class ConfirmForgotPasswordError extends CognitoError {
457
459
  constructor(message, cognitoException) {
458
- super(message);
460
+ super(message, 'ConfirmForgotPasswordError', cognitoException);
459
461
  this.cognitoException = cognitoException;
460
462
  }
461
463
  }
462
464
  export class ResendConfirmationCodeError extends CognitoError {
463
465
  constructor(message, cognitoException) {
464
- super(message);
466
+ super(message, 'ResendConfirmationCodeError', cognitoException);
465
467
  this.cognitoException = cognitoException;
466
468
  }
467
469
  }
468
470
  export class UpdateUserAttributesError extends CognitoError {
469
471
  constructor(message, cognitoException) {
470
- super(message);
472
+ super(message, 'UpdateUserAttributesError', cognitoException);
471
473
  this.cognitoException = cognitoException;
472
474
  }
473
475
  }
474
476
  export class VerifyUserAttributeError extends CognitoError {
475
477
  constructor(message, cognitoException) {
476
- super(message);
478
+ super(message, 'VerifyUserAttributeError', cognitoException);
477
479
  this.cognitoException = cognitoException;
478
480
  }
479
481
  }
480
482
  export class GlobalSignOutError extends CognitoError {
481
483
  constructor(message, cognitoException) {
482
- super(message);
484
+ super(message, 'GlobalSignOutError', cognitoException);
483
485
  this.cognitoException = cognitoException;
484
486
  }
485
487
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vardario/cognito-client",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "Sahin Vardar",