'use strict'; var _templateObject = _taggedTemplateLiteral(['\n Search for an existing issue or open a GitHub issue at\n\n ', '\n '], ['\n Search for an existing issue or open a GitHub issue at\n\n ', '\n ']), _templateObject2 = _taggedTemplateLiteral(['\n \nPlease reinstall Cypress by running: ', '\n '], ['\n \\nPlease reinstall Cypress by running: ', '\n ']), _templateObject3 = _taggedTemplateLiteral(['\n There was a problem spawning Xvfb.\n\n This is likely a problem with your system, permissions, or installation of Xvfb.\n '], ['\n There was a problem spawning Xvfb.\n\n This is likely a problem with your system, permissions, or installation of Xvfb.\n ']), _templateObject4 = _taggedTemplateLiteral(['\n Install XVFB and run Cypress again.\n\n Read our documentation on dependencies for more information:\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n Install XVFB and run Cypress again.\n\n Read our documentation on dependencies for more information:\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']), _templateObject5 = _taggedTemplateLiteral(['\n This is usually caused by a missing library or dependency.\n\n The error below should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n This is usually caused by a missing library or dependency.\n\n The error below should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']), _templateObject6 = _taggedTemplateLiteral(['\n Please search Cypress documentation for possible solutions:\n\n ', '\n\n Check if there is a GitHub issue describing this crash:\n\n ', '\n\n Consider opening a new issue.\n '], ['\n Please search Cypress documentation for possible solutions:\n\n ', '\n\n Check if there is a GitHub issue describing this crash:\n\n ', '\n\n Consider opening a new issue.\n ']), _templateObject7 = _taggedTemplateLiteral(['\n Platform: ', ' (', ')\n Cypress Version: ', '\n '], ['\n Platform: ', ' (', ')\n Cypress Version: ', '\n ']), _templateObject8 = _taggedTemplateLiteral(['', ''], ['', '']); function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } var os = require('os'); var chalk = require('chalk'); var Promise = require('bluebird'); var getos = Promise.promisify(require('getos')); var _require = require('common-tags'), stripIndent = _require.stripIndent, stripIndents = _require.stripIndents; var _require2 = require('ramda'), merge = _require2.merge; var util = require('./util'); var issuesUrl = 'https://github.com/cypress-io/cypress/issues'; var docsUrl = 'https://on.cypress.io'; var requiredDependenciesUrl = docsUrl + '/required-dependencies'; // common errors Cypress application can encounter var failedDownload = { description: 'The Cypress App could not be downloaded.', solution: 'Please check network connectivity and try again:' }; var failedUnzip = { description: 'The Cypress App could not be unzipped.', solution: stripIndent(_templateObject, issuesUrl) }; var missingApp = { description: 'No version of Cypress is installed.', solution: stripIndent(_templateObject2, chalk.cyan('cypress install')) }; var nonZeroExitCodeXvfb = { description: 'XVFB exited with a non zero exit code.', solution: stripIndent(_templateObject3) }; var missingXvfb = { description: 'Your system is missing the dependency: XVFB', solution: stripIndent(_templateObject4, requiredDependenciesUrl) }; var missingDependency = { description: 'Cypress failed to start.', // this message is too Linux specific solution: stripIndent(_templateObject5, requiredDependenciesUrl) }; var versionMismatch = { description: 'Installed version does not match package version.', solution: 'Install Cypress and verify app again' }; var unexpected = { description: 'An unexpected error occurred while verifying the Cypress executable.', solution: stripIndent(_templateObject6, docsUrl, issuesUrl) }; var getOsVersion = function getOsVersion() { if (os.platform() === 'linux') { return getos().then(function (osInfo) { return [osInfo.dist, osInfo.release].join(' - '); }).catch(function () { return os.release(); }); } else { return Promise.resolve(os.release()); } }; function getPlatformInfo() { return getOsVersion().then(function (version) { return stripIndent(_templateObject7, os.platform(), version, util.pkgVersion()); }); } function addPlatformInformation(info) { return getPlatformInfo().then(function (platform) { return merge(info, { platform: platform }); }); } function formErrorText(info, msg) { var hr = '----------'; return addPlatformInformation(info).then(function (obj) { var formatted = []; function add(msg) { formatted.push(stripIndents(_templateObject8, msg)); } add('\n ' + obj.description + '\n\n ' + obj.solution + '\n\n '); if (msg) { add('\n ' + hr + '\n\n ' + msg + '\n\n '); } add('\n ' + hr + '\n\n ' + obj.platform + '\n '); if (obj.footer) { add('\n\n ' + hr + '\n\n ' + obj.footer + '\n '); } return formatted.join('\n'); }); } var raise = function raise(text) { var err = new Error(text); err.known = true; throw err; }; var throwFormErrorText = function throwFormErrorText(info) { return function (msg) { return formErrorText(info, msg).then(raise); }; }; module.exports = { raise: raise, // formError, formErrorText: formErrorText, throwFormErrorText: throwFormErrorText, errors: { nonZeroExitCodeXvfb: nonZeroExitCodeXvfb, missingXvfb: missingXvfb, missingApp: missingApp, missingDependency: missingDependency, versionMismatch: versionMismatch, unexpected: unexpected, failedDownload: failedDownload, failedUnzip: failedUnzip } };