Skip to content

renderAsync can throw synchronously, should return a rejected promise instead? #223

@tomyam1

Description

@tomyam1

This can happen, for instance, if the underlying transformer only supports render.

It will throw synchronously when calling it.

A simple solution would be to wrap all calls to the jstransformer in a try-catch.

What do you think?

More thoughts:

  1. It's bad that renderAsync can do that because other modules don't expect an async function to throw synchronously, e.g. (fix) add filename when jstransformer throws synchronously metalsmith/in-place#174

  2. It's not an issue with the underlying jstransformer because it supports render which can throw synchronously.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions