Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to console detailed error message - resolved #318

Open
dbwcooper opened this issue Nov 26, 2021 · 2 comments
Open

How to console detailed error message - resolved #318

dbwcooper opened this issue Nov 26, 2021 · 2 comments

Comments

@dbwcooper
Copy link

Hi,
I'm learning to use gulp and gulp less to compile some less files. I got some error information, but I can't locate which file reported an error. The error information is as follows:

(node:20992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:20992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

there are my codes:

function combineComponentStyle({ category, type }) {
  return (
    src(`component/**/*.less`)
      .pipe(
        gulpLess({
          compress: true,
          javascriptEnabled: true,
          math: 'always',
        }),
      )
      .pipe(concat(`${type}.css`))
      .pipe(dest(`.theme/color`))
  );
}

What should i do to console more detailed error messages ?

Thank you very much for your help

@dbwcooper
Copy link
Author

It has been solved. That's what I did.

function combineComponentStyle({ category, type }) {
  return (
    src(`component/**/*.less`)
      .pipe(
        gulpLess({
          compress: true,
          javascriptEnabled: true,
          math: 'always',
        }),
      )
      .pipe(concat(`${type}.css`))
      .pipe(dest(`.theme/color`))
      .end(function(error) {
        console.log(error);
      })
  );
}

@dbwcooper dbwcooper changed the title How to console detailed error message How to console detailed error message - resolved Nov 29, 2021
@dbwcooper
Copy link
Author

updated:

function combineComponentStyle({ category, type }) {
   return new Promise((resolve, reject) => {
    src(`component/**/*.less`)
      .pipe(
        gulpLess({
          compress: true,
          javascriptEnabled: true,
          math: 'always',
        }),
      )
      .pipe(concat(`${type}.css`))
      .pipe(dest(`.theme/color`))
      .on('end', resolve)
      .on('error', console.log);
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant