Skip to content

errorHandler #8

@Klabauterman

Description

@Klabauterman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions