1.1.2 • Published 3 years ago

error-mask v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 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

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago