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

Hooks: throw on incorrect async function #1608

Merged
merged 10 commits into from
Apr 29, 2019
Merged

Hooks: throw on incorrect async function #1608

merged 10 commits into from
Apr 29, 2019

Conversation

delvedor
Copy link
Member

As titled.

Wild idea: check at startup if is an async function and the arity, and if it is an async function with 3 arguments, throw an error.

Ref: #1593

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows Code of conduct

@delvedor delvedor added discussion Issues or PRs with this label will never stale bugfix Issue or PR that should land as semver patch backport 1.x Issue or pr that should be backported to Fastify v1 v2.x Issue or pr related to Fastify v2 labels Apr 20, 2019
@delvedor delvedor requested a review from a team April 20, 2019 16:51
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lib/errors.js Outdated Show resolved Hide resolved
fastify.js Outdated Show resolved Hide resolved
fastify.js Show resolved Hide resolved
nwoltman and others added 3 commits April 21, 2019 10:37
Co-Authored-By: delvedor <delvedor@users.noreply.github.com>
@delvedor delvedor requested a review from a team April 21, 2019 08:49
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

fastify.js Outdated Show resolved Hide resolved
fastify.js Show resolved Hide resolved
Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@StarpTech StarpTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

test/hooks-async.js Outdated Show resolved Hide resolved
Co-Authored-By: delvedor <delvedor@users.noreply.github.com>
@delvedor
Copy link
Member Author

I don't understand why the Windows build is failing... 🤬

Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried on my windows 👍

test/hooks-async.js Outdated Show resolved Hide resolved
test/hooks-async.js Outdated Show resolved Hide resolved
Eomm and others added 2 commits April 29, 2019 09:11
Co-Authored-By: delvedor <delvedor@users.noreply.github.com>
Co-Authored-By: delvedor <delvedor@users.noreply.github.com>
@delvedor
Copy link
Member Author

Thanks @Eomm!

@delvedor delvedor merged commit 5e1fdbf into master Apr 29, 2019
@delvedor delvedor deleted the throw-bad-async branch April 29, 2019 07:35
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport 1.x Issue or pr that should be backported to Fastify v1 bugfix Issue or PR that should land as semver patch discussion Issues or PRs with this label will never stale v2.x Issue or pr related to Fastify v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants