Rafff
Rafff

Reputation: 1518

How to throw Error of type FirebaseError

I have a situation where I need to throw an error. The error must match FirebaseError interface.

I tried to import this interface

import { FirebaseError } from '@firebase/util';

But I don't know how to use it

throw new FirebaseError ???

Upvotes: 1

Views: 337

Answers (1)

Francisco Durdin Garcia
Francisco Durdin Garcia

Reputation: 13327

FirebaseErroris an interface. You should create your custom error class that extends from FirebaseError and throw it:

class FirebaseSignInError extends FirebaseError {
}

After that, just call:

throw new FirebaseSignInError

Upvotes: 3

Related Questions