Skip to content

feat: print err.cause if exists - #91

Merged
killagu merged 3 commits into
masterfrom
feat/cause
Sep 5, 2023
Merged

killagu merged 3 commits into
masterfrom
feat/cause

Conversation

@killagu

@killagu killagu commented Aug 30, 2023

Copy link
Copy Markdown
Contributor
Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

Comment thread lib/utils.js

const errProperties = Object.keys(err).map(key => inspect(key, err[key])).join('\n');
return util.format('nodejs.%s: %s\n%s\n%s\npid: %s\nhostname: %s\n',
if (err.cause) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

我以为 err.stack 就会自动打算 cause 的堆栈?

@codecov

codecov Bot commented Sep 5, 2023 •

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03% 🎉

Comparison is base (e4ff375) 98.69% compared to head (ea9dfda) 98.72%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
+ Coverage   98.69%   98.72%   +0.03%     
==========================================
  Files          14       14              
  Lines        1307     1338      +31     
  Branches      215      222       +7     
==========================================
+ Hits         1290     1321      +31     
  Misses         17       17              
Files Changed Coverage Δ
lib/egg/console_logger.js 100.00% <100.00%> (ø)
lib/egg/logger.js 100.00% <100.00%> (ø)
lib/transports/transport.js 100.00% <100.00%> (ø)
lib/utils.js 94.94% <100.00%> (+0.47%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@killagu
killagu merged commit a054bca into master Sep 5, 2023
@killagu
killagu deleted the feat/cause branch September 5, 2023 01:27
fengmk2 pushed a commit that referenced this pull request Sep 5, 2023
[skip ci]

## [3.4.0](v3.3.1...v3.4.0) (2023-09-05)

### Features

* print err.cause if exists ([#91](#91)) ([a054bca](a054bca))
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

Successfully merging this pull request may close these issues.

2 participants