UNPKG

appcenter-cli

Version:

Command line tool for Visual Studio App Center

38 lines (36 loc) 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildErrorInfo = void 0; const commandline_1 = require("../../../util/commandline"); const os = require("os"); function buildErrorInfo(err, profile, command) { const exitCode = err.exitCode || err.errorCode || commandline_1.ErrorCodes.Exception; let message = null; let helpMessage = `Further error details: For help, please send both the reported error above and the following environment information to us by going to https://appcenter.ms/apps and opening a support ticket (using the help menu in the upper right corner of the screen)${os.EOL} Environment: ${os.platform()} App Upload Id: ${command.identifier} Timestamp: ${Date.now()} Operation: ${command.constructor.name} Exit Code: ${exitCode}`; if (profile) { helpMessage += ` User Email: ${profile.email} User Name: ${profile.userName} User Id: ${profile.userId} `; } if (err.message && err.message.indexOf("Not Found") !== -1) { message = `Requested resource not found - please check --app: ${command.identifier}${os.EOL}${os.EOL}${helpMessage}`; } else if (err.errorCode === 5) { message = `Unauthorized error - please check --token or log in to the appcenter CLI.${os.EOL}${os.EOL}${helpMessage}`; } else if (err.errorMessage) { message = `${err.errorMessage}${os.EOL}${os.EOL}${helpMessage}`; } else { message = `${err.message}${os.EOL}${os.EOL}${helpMessage}`; } return { message, exitCode }; } exports.buildErrorInfo = buildErrorInfo;