Skip to content

Commit

Permalink
Revert "use custom error to prevent logging of expected or too common…
Browse files Browse the repository at this point in the history
… issues"

This reverts commit 076bb6f.
  • Loading branch information
ejnshtein committed Mar 25, 2022
1 parent 94fa5e6 commit fc2ff8e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 68 deletions.
6 changes: 1 addition & 5 deletions build-packages/magento-scripts/lib/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,7 @@ module.exports = (yargs) => {
process.exit(0);
} catch (e) {
logger.error(e.message || e);
if (e && e.reportAnalytics) {
await googleAnalytics.trackError(e.message || e);
} else {
logger.logN('skipping reporting...');
}
await googleAnalytics.trackError(e.message || e);
process.exit(1);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
const os = require('os');
const { CMAInstallError } = require('../../../util/cma-error');
const { execAsyncSpawn } = require('../../../util/exec-async-command');
const getIsWsl = require('../../../util/is-wsl');
const installDocker = require('./install');
Expand Down Expand Up @@ -34,36 +33,28 @@ NOTE: After installation it's recommended to log out and log back in so your gro
task: (ctx) => {
task.title = `Using docker version ${ctx.dockerVersion}`;

throw new CMAInstallError(
throw new Error(
`Docker is installed successfully!
Please log out and log back to so your group membership is re-evaluated!
Learn more here: ${ logger.style.link('https://docs.docker.com/engine/install/linux-postinstall/') }`, {
reportAnalytics: false
}
Learn more here: ${ logger.style.link('https://docs.docker.com/engine/install/linux-postinstall/') }`
);
}
}
]);
}

throw new CMAInstallError('Docker is not installed!', {
reportAnalytics: false
});
throw new Error('Docker is not installed!');
} else if (isWsl) {
throw new CMAInstallError(
throw new Error(
`You don't have Docker installed!
Follow this instructions to install Docker on Windows:
${ logger.style.link('https://docs.create-magento-app.com/getting-started/prerequisites/windows-requirements#2-install-docker-desktop-for-windows') }`, {
reportAnalytics: false
}
${ logger.style.link('https://docs.create-magento-app.com/getting-started/prerequisites/windows-requirements#2-install-docker-desktop-for-windows') }`
);
} else {
throw new CMAInstallError(
throw new Error(
`You don't have Docker installed!
Follow this instructions to install Docker on Mac:
${ logger.style.link('https://docs.create-magento-app.com/getting-started/prerequisites/installation-on-macos#3-install-docker-for-mac') }`, {
reportAnalytics: false
}
${ logger.style.link('https://docs.create-magento-app.com/getting-started/prerequisites/installation-on-macos#3-install-docker-for-mac') }`
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const semver = require('semver');
const { CMAInstallError } = require('../../util/cma-error');

/**
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
Expand All @@ -10,11 +9,9 @@ const checkNodeVersion = () => ({
const { node } = process.versions;

if (!semver.gte(node, '12.0.0')) {
throw new CMAInstallError(
throw new Error(
`Your Node.js version is out of date!
You need to upgrade Node.js to at lease version 12 to work with this software!`, {
reportAnalytics: false
}
You need to upgrade Node.js to at lease version 12 to work with this software!`
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const fs = require('fs');
const path = require('path');
const semver = require('semver');
const phpbrewConfig = require('../../config/phpbrew');
const { CMAInstallError } = require('../../util/cma-error');
const { execAsyncSpawn } = require('../../util/exec-async-command');
const pathExists = require('../../util/path-exists');
const compileOptions = require('../php/compile-options');
Expand Down Expand Up @@ -83,11 +82,9 @@ export PHPBREW_PATH=${phpbrewConfig.homePath}/php/${phpbrewPHPName}/bin
throw new Error(`Something went wrong when trying to switch PHP to ${phpbrewPHPName}!\n\n${e}`);
}

throw new CMAInstallError(`You will need to restart your terminal and run ${logger.style.command('start')} again.
throw new Error(`You will need to restart your terminal and run ${logger.style.command('start')} again.
You can use keyboard shortcut ${logger.style.command('CTRL+D')} to close terminal.`, {
reportAnalytics: false
});
You can use keyboard shortcut ${logger.style.command('CTRL+D')} to close terminal.`);
},
options: {
bottomBar: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const { platforms, darwinMinimalVersion } = require('../../config');
const dependencyCheck = require('./dependency');
const { getArch } = require('../../util/arch');
const getIsWsl = require('../../util/is-wsl');
const { CMAError } = require('../../util/cma-error');

/**
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
Expand All @@ -17,7 +16,7 @@ const checkPlatform = () => ({
const currentPlatform = os.platform();

if (!platforms.includes(currentPlatform)) {
throw new CMAError(
throw new Error(
`Your current OS platform is ${ logger.style.misc(currentPlatform) }.
Unfortunately, currently we only support ${ platforms.map((platform) => logger.style.misc(platform)).join(',') }.`
);
Expand Down
35 changes: 0 additions & 35 deletions build-packages/magento-scripts/lib/util/cma-error.js

This file was deleted.

0 comments on commit fc2ff8e

Please sign in to comment.