Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errorHandler #8

Open
Klabauterman opened this issue Jul 21, 2022 · 0 comments
Open

errorHandler #8

Klabauterman opened this issue Jul 21, 2022 · 0 comments

Comments

@Klabauterman
Copy link

I am using typescript and I am seeing the errorHandler as required, but I think it should be optional:

app.use(
  authMiddleWare.authn(admin.auth(), {
    attachUserTo: "token",
    errorHandler: () => {
      functions.logger.log("INVALID AUTHENTICATION");
    },
  })
);

So if I want to pass in attachUserTo I must pass in errorHandler as well.

Furthermore I don't really get, how it can be used. In the source code, I see:

if (errorHandler) {
      // Set status onto object too so that user's error handler can have access to it
      resObj.status = status;
      errorHandler(resObj);
    }

resObj seems to be not defined and I think the request and response should be passed as parameters as well to implement something useful with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant