You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to understand how I should be leveraging the Errors formatter in my own project. I tried following along with the example, but I get a TypeError. Is the example possibly out of date?
> const {format} = require('logform')
undefined
> const { errors } = format
undefined
> const fmt = errors({stack: true})
undefined
> const info = fmt.transform(new Error('oh no!'))
TypeError: Cannot destructure property `stack` of 'undefined' or 'null'.
at Format.module.exports.format [as transform] (/Users/jjdonov/<omitted>/node_modules/logform/errors.js:14:25)
at repl:1:18
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at REPLServer.defaultEval (repl.js:240:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:441:10)
at emitOne (events.js:121:20)
at REPLServer.emit (events.js:211:7)
at REPLServer.Interface._onLine (readline.js:282:10)
I am using logform 2.1.2, included with winston 3.2.1
transform method expectsalways to have 2 arguments that it passes internally. There is in winston repo. If you use fmt.transform manually you need to pass fmt.options
Thanks @JIoJIaJIu
While that makes sense, I still think that the example in the documentation is misleading as it only passes one argument as I have above
Hi there,
Trying to understand how I should be leveraging the Errors formatter in my own project. I tried following along with the example, but I get a
TypeError
. Is the example possibly out of date?I am using logform 2.1.2, included with winston 3.2.1
The text was updated successfully, but these errors were encountered: