Skip to content

properties throws RangeError: Invalid time value when the error object has field of type Date with value Invalid Date #17

@nedyalkov

Description

@nedyalkov

If you call the properties method on an error object that has a field of type Date with a value Invalid Date, it tries to call the toISOString method of this object and throws an error: RangeError: Invalid time value.

To reproduce this, do the following:

var stackman = require('stackman')()

var err = new Error('Oops!')
err.number = Number.NaN;
err.date = new Date('invalid')

var props = stackman.properties(err)
console.log(props)

If you comment out err.date = new Date('invalid') or change the value to a valid date, the code works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions