https://github.com/qwyzex/firerr
Firebase Error Catching
https://github.com/qwyzex/firerr
firebase
Last synced: 1 day ago
JSON representation
Firebase Error Catching
- Host: GitHub
- URL: https://github.com/qwyzex/firerr
- Owner: qwyzex
- License: mit
- Created: 2022-01-29T14:35:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-09T08:37:47.000Z (over 4 years ago)
- Last Synced: 2025-08-26T12:05:34.716Z (10 months ago)
- Topics: firebase
- Language: TypeScript
- Homepage: https://npmjs.com/package/firerr
- Size: 163 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# FirErr
FirErr is a package for catching Firebase Errors that often occurs. Firebase can only send one response at a time, so catching it _one-by-one_ is not that bad, I think.
## 🤔 Usage
You can use it by defining a state, or variables that store the Firebase Error Message :
```
import { useState } from "react";
const [formError, setFormError] = useState("");
```
Then do some 🔥 Firebase Stuff :
```js
async function login(e) {
e.preventDefault();
await createUserWithEmailAndPassword(auth, formEmail, formPassword)
.then(() => {
// finish
})
.catch((error) => {
const code = error.code;
firerr(code, formError);
});
}
```
## `firerrString()` function
```js
import { firerrString } from "firerr";
async function login(e) {
e.preventDefault();
await createUserWithEmailAndPassword(auth, formEmail, formPassword)
.then(() => {
// finish
})
.catch((error) => {
const code = error.code;
alert(firerrString(code));
});
}
```
> 🥶 Idk who install this package tho...
> This is my very first NPM Package.
> I am very sorry if there's a problem! I'm only 14 yo, 15 next September 🤧
>
> \- qwyzex, 2022