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

Handling failed lookups? #4

Closed
mikestecker opened this issue Apr 12, 2021 · 0 comments
Closed

Handling failed lookups? #4

mikestecker opened this issue Apr 12, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mikestecker
Copy link

I tested a random email address ([email protected]) and received the following error:

node:internal/process/promises:245
          triggerUncaughtException(err, true /* fromPromise */);

[Error: ENOENT: no such file or directory, open '/Development/test/node_modules/academic-email-verifier/domains/com/me.txt'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Development/test/node_modules/academic-email-verifier/domains/com/me.txt'
}

error Command failed with exit code 1.

I checked your database files and saw there was indeed nothing there... It seems that getInstitutionName doesn't gracefully fail and crashes Node. Can you add some error checking?

My workaround is:

  const isAcademic = await Verifier.isAcademic(email);
  let collegeName: string | undefined;
  if (isAcademic) {
    const institutionName = await Verifier.getInstitutionName(email);
    collegeName = institutionName !== '' ? institutionName : undefined
  }
@bennymeg bennymeg added the bug Something isn't working label Jun 17, 2021
@bennymeg bennymeg self-assigned this Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants