Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Print stack to trace where the warning comes from #6155

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ process.on('unhandledRejection', function (error, promise) {
handleUncaughtError(error)
})

process.on('warning', warning => console.warn(warning.stack))
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should also print warning.message first?

Copy link
Member Author

Choose a reason for hiding this comment

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

But it has already printed name: message + stack. Ex.

DeprecationWarning: Calling an asynchronous function without callback is deprecated.
    at maybeCallback (fs.js:95:42)
    at Object.fs.appendFile (fs.js:1237:14)
    at debug (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/updater.js:30:6)
    at Object.exports.updateUrl (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/updater.js:52:3)
    at Object.exports.init (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/updater.js:91:25)
    at PackageLoader.load (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/index.js:732:15)
    at fs.readFile (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/package-loader.js:16:5)
    at tryToString (fs.js:425:3)

It would be like this after added

DeprecationWarning
Calling an asynchronous function without callback is deprecated.
DeprecationWarning: Calling an asynchronous function without callback is deprecated.
    at maybeCallback (fs.js:95:42)
    at Object.fs.appendFile (fs.js:1237:14)
    at debug (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/updater.js:30:6)
    at AutoUpdater.autoUpdater.on (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/updater.js:246:3)
    at emitTwo (events.js:106:13)
    at AutoUpdater.emit (events.js:191:7)
    at Object.exports.init (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/updater.js:98:19)
    at PackageLoader.load (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/index.js:736:15)
    at fs.readFile (/Users/darkdh/Projects/browser-laptop-bootstrap2/src/browser-laptop/app/package-loader.js:16:5)
    at tryToString (fs.js:425:3)

Plus node's warning message might be too many of them

(node:18561) DeprecationWarning: Calling an asynchronous function without callback is deprecated.


if (process.platform === 'win32') {
require('./windowsInit')
}
Expand Down