MCPcopy Create free account
hub / github.com/adaptlearning/adapt_framework / logPrettyError

Function logPrettyError

grunt/tasks/javascript.js:96–121  ·  view source on GitHub ↗
(err, cachePath, basePath)

Source from the content-addressed store, hash-verified

94 };
95
96 const logPrettyError = (err, cachePath, basePath) => {
97 let hasOutput = false;
98 if (err.loc) {
99 // Code error
100 switch (err.plugin) {
101 case 'babel':
102 err.frame = err.message.substr(err.message.indexOf('\n') + 1);
103 err.message = err.message.substr(0, err.message.indexOf('\n')).slice(2).replace(/^([^:]*): /, '');
104 break;
105 default:
106 hasOutput = true;
107 console.error(err.toString());
108 }
109 if (!hasOutput) {
110 console.error(err.toString());
111 console.error(`Line: ${err.loc.line}, Col: ${err.loc.column}, File: ${err.id.replace(cwd, '')}`);
112 console.error(err.frame);
113 hasOutput = true;
114 }
115 }
116 if (!hasOutput) {
117 cache = null;
118 saveCache(cachePath, basePath, cache);
119 console.error(err.toString());
120 }
121 };
122
123 grunt.registerMultiTask('javascript', 'Compile JavaScript files', async function() {
124 const Helpers = require('../helpers')(grunt);

Callers 1

javascript.jsFile · 0.85

Calls 1

saveCacheFunction · 0.85

Tested by

no test coverage detected