Skip to content

avoid thrown error crashing server? #2443

@artofspeed

Description

@artofspeed

For some reason, sometimes I encounter the error Lone surrogate ... is not a scalar value. And this will make my entire app crash. By checking the detail, this is caused by an internal function in the utf8.js file:

    function checkScalarValue(codePoint) {
        if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
            throw Error(
                'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
                ' is not a scalar value'
            );
        }
    }

Is there a way to catch this error somehow in my client code, to avoid it crashing the whole server? Or else, some naughty boy could send invalid UTF string and keep crashing the server :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions