From 0dedd3e8790f568527b8a2444720fe47048ba719 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 15 Dec 2021 12:23:43 +0100 Subject: [PATCH] fix(CLI): Improve error handler resolution Ensure it's bulletproof against serverless installation issues --- lib/cli/handle-error.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cli/handle-error.js b/lib/cli/handle-error.js index 902a4fb6c6a..2e1e267d6eb 100644 --- a/lib/cli/handle-error.js +++ b/lib/cli/handle-error.js @@ -4,6 +4,7 @@ const path = require('path'); const isObject = require('type/object/is'); const chalk = require('chalk'); const stripAnsi = require('strip-ansi'); +const _ = require('lodash'); const sfeVersion = require('@serverless/dashboard-plugin/package.json').version; const { platformClientVersion } = require('@serverless/dashboard-plugin'); const { getDashboardProvidersUrl } = require('@serverless/dashboard-plugin/lib/dashboard'); @@ -105,7 +106,7 @@ module.exports = async (exception, options = {}) => { } })(); - if (localErrorHandlerData) { + if (_.get(localErrorHandlerData, 'handle')) { localErrorHandlerData.handle(exception, localErrorHandlerData.options); return; }