Skip to content

Expose "jse_shortmsg" publicly #70

@WangHansen

Description

@WangHansen

This is exactly the same request as the #52.

The use case is that I want to capture the entire error with all the causes for debugging, logging and other purposes. But when I return the JSON back to the client. I only want the user to see what is in the "jse_shortmsg".

For example:

// Example error from third-party library
const originalError = new MongoError("Duplicate keys detected")

// Example error I handle on my server
const error = VError(originalError, "Failed to update record")

// This would log: "Failed to update record: Duplicate keys detected"
logger.log(error.message)

// I only want user to see "Failed to update record"
res.json({ message: error["jse_shortmsg"] })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions