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

feat: Log when error occurs while pushing #28

Merged
merged 2 commits into from
Apr 18, 2018
Merged

Conversation

jinwoo
Copy link
Member

@jinwoo jinwoo commented Apr 18, 2018

And upgrade h2-auto-push to v0.4.0.

Also update other packages.

And upgrade `h2-auto-push` to v0.4.0.

Also update other packages.
@codecov-io
Copy link

codecov-io commented Apr 18, 2018

Codecov Report

Merging #28 into master will decrease coverage by 2.42%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
- Coverage   97.29%   94.87%   -2.43%     
==========================================
  Files           1        1              
  Lines          37       39       +2     
  Branches        8        8              
==========================================
+ Hits           36       37       +1     
- Misses          1        2       +1
Impacted Files Coverage Δ
ts/src/index.ts 94.87% <66.66%> (-2.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d885d4b...dc6eccb. Read the comment docs.

@jinwoo jinwoo requested a review from a team April 18, 2018 16:43
@jinwoo
Copy link
Member Author

jinwoo commented Apr 18, 2018

/cc @mcollina

ts/src/index.ts Outdated
@@ -70,7 +70,10 @@ async function staticServeFn(
'set-cookie',
cookie.serialize(CACHE_COOKIE_KEY, newCacheCookie, {path: '/'}));

pushFn(reqStream).then(noop, noop);
reqStream.on('pushError', (err) => {
app.log.error('Error while pushing', err);

Choose a reason for hiding this comment

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

You can use req.log.error, in this way the log will also have the request id and support the custom log level on plugin/route basis :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to, but here in the onRequest hook, the request object is not a fastify request but a raw request. Do I have a better option?

Choose a reason for hiding this comment

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

log is present in both fastify request and raw request :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good to know. Thanks. Updated.

Copy link
Contributor

@ofrobots ofrobots left a comment

Choose a reason for hiding this comment

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

LGTM, once the req.log question is figured out.

@jinwoo jinwoo merged commit 43cd2ff into google:master Apr 18, 2018
@jinwoo jinwoo deleted the push-error branch April 18, 2018 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants