Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

logError.js 987B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.logError = void 0;
  4. const logger_1 = require("./logger");
  5. const clc = require("colorette");
  6. function logError(error) {
  7. if (error.children && error.children.length) {
  8. logger_1.logger.error(clc.bold(clc.red("Error:")), clc.underline(error.message) + ":");
  9. error.children.forEach((child) => {
  10. let out = "- ";
  11. if (child.name) {
  12. out += clc.bold(child.name) + " ";
  13. }
  14. out += child.message;
  15. logger_1.logger.error(out);
  16. });
  17. }
  18. else {
  19. if (error.original) {
  20. logger_1.logger.debug(error.original.stack);
  21. }
  22. logger_1.logger.error();
  23. logger_1.logger.error(clc.bold(clc.red("Error:")), error.message);
  24. }
  25. if (error.context) {
  26. logger_1.logger.debug("Error Context:", JSON.stringify(error.context, undefined, 2));
  27. }
  28. }
  29. exports.logError = logError;