MCPcopy
hub / github.com/ampproject/amphtml / handleInvalidTaskError

Function handleInvalidTaskError

build-system/task-runner/amp-task-runner.js:116–129  ·  view source on GitHub ↗

* Prints an error if the task file and / or function are invalid, and exits. * @param {string} taskSourceFileName * @param {string=} taskFuncName

(taskSourceFileName, taskFuncName)

Source from the content-addressed store, hash-verified

114 * @param {string=} taskFuncName
115 */
116function handleInvalidTaskError(taskSourceFileName, taskFuncName) {
117 log(
118 red('ERROR:'),
119 'Could not find' + (taskFuncName ? ` ${cyan(taskFuncName + '()')} in` : ''),
120 cyan(path.join('build-system', 'tasks', taskSourceFileName)) + '.'
121 );
122 log(
123 '⤷ Please check the arguments to',
124 cyan('createTask()'),
125 'in',
126 cyan('amp.js') + '.'
127 );
128 process.exit(1);
129}
130
131/**
132 * Returns a task's source file path after making sure it is either a valid JS

Callers 2

getTaskSourceFilePathFunction · 0.85
getTaskFuncFunction · 0.85

Calls 4

redFunction · 0.85
cyanFunction · 0.85
exitMethod · 0.80
logFunction · 0.50

Tested by

no test coverage detected