Skip to content

Commit

Permalink
refactor: Improve error message for docker failures
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Sep 28, 2022
1 parent 7c6e485 commit cc146d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ async function installRequirements(targetFolder, pluginInstance) {
'PYTHON_REQUIREMENTS_COMMAND_NOT_FOUND'
);
}

if (cmd === 'docker' && e.stderrBuffer) {
throw new pluginInstance.serverless.classes.Error(
`Running ${cmd} failed with: "${e.stderrBuffer.toString().trim()}"`,
'PYTHON_REQUIREMENTS_DOCKER_COMMAND_FAILED'
);
}

if (log) {
log.info(`Stdout: ${e.stdoutBuffer}`);
log.info(`Stderr: ${e.stderrBuffer}`);
Expand Down

0 comments on commit cc146d0

Please sign in to comment.