Skip to content

File creation errors not propogated #83

@matmar10

Description

@matmar10

From: lib/generate.js

The following code uses CPS-style but it's within a promise chain.

The errors thrown are inside callbacks, hence they will never be returned up the promise chain.

      mkdirp(path.dirname(dest), function(err) {
        if (err) {
          // this has no effect on the promise chain, since it's inside a callback
          throw err;
        }

        fs.writeFile(dest, html, 'utf8', function(err) {
          if (err) {
            // this has no effect on the promise chain, since it's inside a callback
            throw err;
          }
        });

      });

Also, the following handling at the end will log errors from the promise chain, but will not allow them to propogate:

    .catch(function(err) {
      if (err) {
        console.error(err.stack);
      }
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions