1.1.2 • Published 11 months ago

error-mask v1.1.2

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

11 months ago

1.1.2

11 months ago

1.1.0

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago