1.1.2 • Published 2 years ago

error-mask v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Error-Mask

The package for all you error to be beautified.

Support

Currently we support Firebase (Firestore , Authentication , Storage) and MongoDb(Beta) - Errors code.

Use

Install the package

npm i error-mask

or

yarn add error-mask

Import the Package in you file

// import all the required functions
import {getFirebaseAuthError , getFirebaseStoreError , getFirebaseStorageError , getMongoError} from "error-mask"


import { getAuth, createUserWithEmailAndPassword } from "firebase/auth";

const auth = getAuth();
createUserWithEmailAndPassword(auth, email, password)
  .then((userCredential) => {
    // Signed in 
    const user = userCredential.user;

  })
  .catch((error) => {
    const errorCode = error.code;
    
    // let there be an error code of "auth/email-already-exists"

    console.log(getFirebaseAuthError(errorCode).message) // this will print "Email Already in Use"

    // use this message in a toast or anything where user can see
  });

Pass The Error Code to the function and error-mask will give you the Human readable string

Contribution

Contributions are always welcomed

1.1.1

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago