Skip to content

'Invalid URL' error message different in Node 18 #2107

@DanCurryy

Description

@DanCurryy

Describe the bug

  • Node.js version: v18.7.0
  • OS & version: Mac OS Monterey 12.4

Actual behavior

Expected error.message to be of the form (as seen in node v14.17.6):
Invalid URL: invalid-url.com

Expected behavior

We receive an error message:
Invalid URL

Without the URL included in the message

Code to reproduce

async function test () {
  const { default: got } = await import('got')
  return got.get('invalid-url.com')
}

function main () {
  return test()
    .then(res => {
      console.log(res)
    })
    .catch(err => {
      console.log(err.message)
    })
}

main()

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.

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