Skip to content

Make JS_ToCString return legible result for InternalErrors #273

@bnoordhuis

Description

@bnoordhuis

Sometimes, calling JS_ToCString(ctx, val) where val is an instance of InternalError returns an empty string. Not very helpful when the exception object does in fact have a .message property with a human-readable error message.

Probably happens when there is a pending exception. Deep down, quickjs tries to invoke the [Symbol.toPrimitive] method but I doubt that works while an exception is pending.

Let's make debugging a little less miserable and special-case exception objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions