volta icon indicating copy to clipboard operation
volta copied to clipboard

No useful feedback on failure w/ package.json that has conflicts

Open mike-north opened this issue 7 years ago • 3 comments

NOTE: this issue predates this project's rename to Volta.

Repro Instructions

Create a repo with this package.json

package.json
{
  "name": "ember-cli-document-title-northm",
  "version": "0.0.0-development",
  "description": "Adding document title functionality to your ember app",
  "keywords": [
    "ember-addon"
  ],
  "homepage": "https://github.com/mike-north/ember-cli-document-title-northm",
  "bugs": {
    "url": "https://github.com/mike-north/ember-cli-document-title-northm/issues"
  },
  "license": "MIT",
  "author": "Mike North <[email protected]> (https://mike.works)",
  "main": "index.js",
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/mike-north/ember-cli-document-title-northm.git"
  },
  "scripts": {
    "build": "ember build",
    "lint:js": "eslint .",
    "start": "ember serve",
    "test": "ember test",
    "travis-deploy-once": "travis-deploy-once",
    "semantic-release": "semantic-release"
  },
  "dependencies": {
    "ember-cli-babel": "^6.6.0"
  },
  "devDependencies": {
    "@commitlint/cli": "7.2.1",
    "@commitlint/config-conventional": "7.1.2",
    "@commitlint/travis-cli": "7.2.1",
<<<<<<< HEAD
    "@mike-north/js-lib-renovate-config": "^1.0.0",
    "@mike-north/js-lib-semantic-release-config": "^1.0.1",
    "@types/ember": "^3.0.25",
    "@types/ember__test-helpers": "^0.7.6",
    "broccoli-asset-rev": "^2.7.0",
    "chai": "^4.1.2",
    "ember-cli": "^3.6.0-beta.1",
    "ember-cli-dependency-checker": "^3.0.0",
    "ember-cli-eslint": "^4.2.1",
    "ember-cli-htmlbars": "^2.0.1",
    "ember-cli-htmlbars-inline-precompile": "^1.0.0",
    "ember-cli-inject-live-reload": "^1.8.2",
    "ember-cli-qunit": "^4.3.2",
    "ember-cli-shims": "^1.2.0",
    "ember-cli-sri": "^2.1.1",
    "ember-cli-uglify": "^2.0.0",
    "ember-disable-prototype-extensions": "^1.1.2",
    "ember-export-application-global": "^2.0.0",
    "ember-fastboot-addon-tests": "^0.4.0",
    "ember-load-initializers": "^1.1.0",
    "ember-maybe-import-regenerator": "^0.1.6",
    "ember-resolver": "^4.0.0",
    "ember-source": "~3.3.0",
    "ember-source-channel-url": "^1.0.1",
    "ember-try": "^1.1.0",
    "eslint-plugin-ember": "^5.0.0",
    "eslint-plugin-node": "^6.0.1",
    "husky": "^1.2.0",
    "loader.js": "^4.2.3",
    "qunit-dom": "^0.6.2",
    "travis-deploy-once": "^5.0.9"
=======
    "@mike-north/js-lib-renovate-config": "1.0.0",
    "@mike-north/js-lib-semantic-release-config": "1.0.1",
    "broccoli-asset-rev": "2.7.0",
    "chai": "4.2.0",
    "ember-cli": "3.6.0-beta.1",
    "ember-cli-dependency-checker": "3.0.0",
    "ember-cli-eslint": "4.2.3",
    "ember-cli-htmlbars": "2.0.5",
    "ember-cli-htmlbars-inline-precompile": "1.0.5",
    "ember-cli-inject-live-reload": "1.10.2",
    "ember-cli-qunit": "4.4.0",
    "ember-cli-shims": "1.2.0",
    "ember-cli-sri": "2.1.1",
    "ember-cli-uglify": "2.1.0",
    "ember-disable-prototype-extensions": "1.1.3",
    "ember-export-application-global": "2.0.0",
    "ember-fastboot-addon-tests": "0.5.0",
    "ember-load-initializers": "1.1.0",
    "ember-maybe-import-regenerator": "0.1.6",
    "ember-resolver": "4.5.6",
    "ember-source": "3.5.1",
    "ember-source-channel-url": "1.1.0",
    "ember-try": "1.1.0",
    "eslint-plugin-ember": "5.4.0",
    "eslint-plugin-node": "6.0.1",
    "husky": "1.2.0",
    "loader.js": "4.7.0",
    "qunit-dom": "0.8.1",
    "travis-deploy-once": "5.0.9"
>>>>>>> 1b0732bc6d56cd3e87c32220760a687341129660
  },
  "engines": {
    "node": "6.* || 8.* || >= 10.*"
  },
  "ember-addon": {
    "configPath": "tests/dummy/config"
  },
  "commitlint": {
    "extends": [
      "@commitlint/config-conventional"
    ]
  },
  "husky": {
    "hooks": {
      "commit-msg": "./node_modules/.bin/commitlint -e $HUSKY_GIT_PARAMS"
    }
  },
  "release": {
    "extends": "@mike-north/js-lib-semantic-release-config"
  },
  "toolchain": {
    "node": "8.11.4",
    "yarn": "1.9.2"
  }
}

and then attempt to run yarn

The error

Notion error: an internal error occurred

details: NotionError { error: ErrorImpl { code: KeyMustBeAString, line: 38, column: 1 }, user_friendly: false, exit_code: UnknownError }

stack backtrace:
   0:        0x10fa807ee - backtrace::backtrace::trace::hfab6a7185938ac36
   1:        0x10fa80c9c - backtrace::capture::Backtrace::new_unresolved::ha79782baa461e437
   2:        0x10fa7fcbd - failure::backtrace::internal::InternalBacktrace::new::hbcb9739880567208
   3:        0x10fa7feb4 - _$LT$failure..backtrace..Backtrace$u20$as$u20$core..default..Default$GT$::default::h65a4b2a10e0d004f
   4:        0x10fa7ff2d - failure::backtrace::Backtrace::new::he387e9ad94c85896
   5:        0x10f9c77e3 - _$LT$core..result..Result$LT$T$C$$u20$E$GT$$u20$as$u20$notion_fail..ResultExt$LT$T$C$$u20$E$GT$$GT$::unknown::hdfbc234154842748
   6:        0x10f973ae4 - notion_core::manifest::Manifest::for_dir::he015dccbe7534fea
   7:        0x10f974085 - notion_core::project::Project::for_dir::h5660b22e7bfd788b
   8:        0x10f973f1e - notion_core::project::Project::for_current_dir::h79f6cbc9980498e8
   9:        0x10f9c9a84 - notion_core::session::Session::new::h218b3e8a51ab2886
  10:        0x10f9458ab - notion_core::tool::Tool::launch::ha629c9c74094e603
  11:        0x10f945238 - yarn::main::hacc86d452ac61ed0
  12:        0x10f945205 - std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h1433e35cefe112a7
  13:        0x10fbf7b97 - std::panicking::try::do_call::h90c8830c237e1486 (.llvm.8493183658544739721)
  14:        0x10fc0430e - __rust_maybe_catch_panic
  15:        0x10fbe84fc - std::rt::lang_start_internal::h15876038f4767761
  16:        0x10f94526b - main

As a user, I'd want some information about my package.json being non-json or otherwise malformed -- maybe even providing an indication of where the problem exists in the json file.

mike-north avatar Nov 24 '18 02:11 mike-north

Related information about detecting merge conflicts: https://github.com/rust-lang/rust/issues/36879

mike-north avatar Nov 28 '18 12:11 mike-north

Just to save additional searching, https://github.com/rust-lang/rust/issues/32059 is another issue related to this.

rwjblue avatar Nov 28 '18 13:11 rwjblue

One possible strategy for solving this: when we detect a parse failure when trying to read package.json, check it for conflict markers with a straightforward regex match on the string contents of the package.json file and report a more specific error type if so; otherwise, return the original error type.

chriskrycho avatar Dec 20 '23 01:12 chriskrycho