Skip to content

Commit

Permalink
refactor(CLI): Reconfigure dashboard related warning to modern logs
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 5, 2021
1 parent 5f1a916 commit 7c91cde
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/serverless.js
Expand Up @@ -15,7 +15,7 @@ if (require('../lib/utils/tabCompletion/isSupported') && process.argv[2] === 'co

// Setup log writing
require('@serverless/utils/log-reporters/node');
const { progress } = require('@serverless/utils/log');
const { legacy, log, progress } = require('@serverless/utils/log');

const handleError = require('../lib/cli/handle-error');
const {
Expand Down Expand Up @@ -870,17 +870,23 @@ const processSpanPromise = (async () => {
try {
await dashboardErrorHandler(error, serverless.invocationId);
} catch (dashboardErrorHandlerError) {
const log = require('@serverless/utils/log');
const tokenizeException = require('../lib/utils/tokenize-exception');
const exceptionTokens = tokenizeException(dashboardErrorHandlerError);
log(
legacy.log(
`Publication to Serverless Dashboard errored with:\n${' '.repeat('Serverless: '.length)}${
exceptionTokens.isUserError || !exceptionTokens.stack
? exceptionTokens.message
: exceptionTokens.stack
}`,
{ color: 'orange' }
);
log.warning(
`Publication to Serverless Dashboard errored with:\n${' '.repeat('Serverless: '.length)}${
exceptionTokens.isUserError || !exceptionTokens.stack
? exceptionTokens.message
: exceptionTokens.stack
}`
);
}
throw error;
}
Expand Down

0 comments on commit 7c91cde

Please sign in to comment.