Skip to content

promise.json() doesn't throw ParseError #1069

@szmarczak

Description

@szmarczak
const got = require('got');

(async () => {
    try {
        // This works as expected
        // await got('https://example.com', {responseType: 'json'}).json();

        // This is incorrect
        await got('https://example.com').json();
    } catch (error) {
        console.log(error.name);
        // Actual: SyntaxError
        // Expected: Got.ParseError
    }
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething does not work as it shouldregressionSomething does not work anymore✭ help wanted ✭

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions