{"action":"created","issue":{"url":"https://api.github.com/repos/google/clasp/issues/344","repository_url":"https://api.github.com/repos/google/clasp","labels_url":"https://api.github.com/repos/google/clasp/issues/344/labels{/name}","comments_url":"https://api.github.com/repos/google/clasp/issues/344/comments","events_url":"https://api.github.com/repos/google/clasp/issues/344/events","html_url":"https://github.com/google/clasp/issues/344","id":367496004,"node_id":"MDU6SXNzdWUzNjc0OTYwMDQ=","number":344,"title":"unhandled promise rejection","user":{"login":"JaimeChavarriaga","id":1813308,"node_id":"MDQ6VXNlcjE4MTMzMDg=","avatar_url":"https://avatars3.githubusercontent.com/u/1813308?v=4","gravatar_id":"","url":"https://api.github.com/users/JaimeChavarriaga","html_url":"https://github.com/JaimeChavarriaga","followers_url":"https://api.github.com/users/JaimeChavarriaga/followers","following_url":"https://api.github.com/users/JaimeChavarriaga/following{/other_user}","gists_url":"https://api.github.com/users/JaimeChavarriaga/gists{/gist_id}","starred_url":"https://api.github.com/users/JaimeChavarriaga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaimeChavarriaga/subscriptions","organizations_url":"https://api.github.com/users/JaimeChavarriaga/orgs","repos_url":"https://api.github.com/users/JaimeChavarriaga/repos","events_url":"https://api.github.com/users/JaimeChavarriaga/events{/privacy}","received_events_url":"https://api.github.com/users/JaimeChavarriaga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/google/clasp/milestones/1","html_url":"https://github.com/google/clasp/milestone/1","labels_url":"https://api.github.com/repos/google/clasp/milestones/1/labels","id":3246868,"node_id":"MDk6TWlsZXN0b25lMzI0Njg2OA==","number":1,"title":"Clasp V2","description":"For the next version of `clasp`, I'd like to make it ridiculously simple and easy to use the tool. Let's use features of modern CLIs. Watch, log, autocomplete, use TypeScript.","creator":{"login":"grant","id":744973,"node_id":"MDQ6VXNlcjc0NDk3Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/744973?v=4","gravatar_id":"","url":"https://api.github.com/users/grant","html_url":"https://github.com/grant","followers_url":"https://api.github.com/users/grant/followers","following_url":"https://api.github.com/users/grant/following{/other_user}","gists_url":"https://api.github.com/users/grant/gists{/gist_id}","starred_url":"https://api.github.com/users/grant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grant/subscriptions","organizations_url":"https://api.github.com/users/grant/orgs","repos_url":"https://api.github.com/users/grant/repos","events_url":"https://api.github.com/users/grant/events{/privacy}","received_events_url":"https://api.github.com/users/grant/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":10,"state":"open","created_at":"2018-04-06T04:26:57Z","updated_at":"2018-11-09T06:15:11Z","due_on":"2018-12-14T08:00:00Z","closed_at":null},"comments":2,"created_at":"2018-10-06T21:07:44Z","updated_at":"2018-11-10T02:11:02Z","closed_at":null,"author_association":"NONE","body":"When I try to run some commands with a wrong user, the `clasp` shows error messages caused by problems with the permissions but remains frozen.\r\n\r\n## Expected Behavior\r\n\r\nTrying to run a command, `clasp` must show an error message and end.\r\n\r\n```\r\n$ clasp logs --json\r\nError: User has not been authorized\r\n(end)\r\n```\r\n\r\n*NOTE:* This happens also with other commands such as `clasp deploy`.\r\n\r\n## Actual Behavior\r\n\r\nThe `clasp` application shows an error...\r\n\r\n```\r\n clasp logs --json\r\n- Using local credentials: ./clasprc.json 🔐 Grabbing logs...(node:16843) UnhandledPromiseRejectionWarning: Error: The caller does not have permission\r\n    at createError (/usr/lib/node_modules/@google/clasp/node_modules/axios/lib/core/createError.js:16:15)\r\n    at settle (/usr/lib/node_modules/@google/clasp/node_modules/axios/lib/core/settle.js:18:12)\r\n    at Unzip.handleStreamEnd (/usr/lib/node_modules/@google/clasp/node_modules/axios/lib/adapters/http.js:201:11)\r\n    at emitNone (events.js:111:20)\r\n    at Unzip.emit (events.js:208:7)\r\n    at endReadableNT (_stream_readable.js:1064:12)\r\n    at _combinedTickCallback (internal/process/next_tick.js:139:11)\r\n    at process._tickCallback (internal/process/next_tick.js:181:9)\r\n(node:16843) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)\r\n(node:16843) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.\r\n/ Using local credentials: ./clasprc.json \r\n🔐 Grabbing logs...\r\n```\r\n\r\nbut remains frozen. I must stop the `clasp` using `[Ctrl]+[C]`\r\n\r\n## Steps to Reproduce the Problem\r\n\r\n  1. Create an App Script project where users can see the project if they have the link\r\n  1. Login using `clasp`:  `clasp login`\r\n  1. Clone/Pull the content of the above mentioned project:  `clasp clone ....`\r\n  1. Run commands such as `clasp deploy` or `clasp login --json`\r\n\r\n## Specifications\r\n\r\n  - Node version (`node -v`): v10.11.0  \r\n  - Version (`clasp -v`): 1.6.3\r\n  - OS (Mac/Linux/Windows): Linux -- Ubuntu 18.04.1 LTS\r\n"},"comment":{"url":"https://api.github.com/repos/google/clasp/issues/comments/437550085","html_url":"https://github.com/google/clasp/issues/344#issuecomment-437550085","issue_url":"https://api.github.com/repos/google/clasp/issues/344","id":437550085,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzU1MDA4NQ==","user":{"login":"takanakahiko","id":10114717,"node_id":"MDQ6VXNlcjEwMTE0NzE3","avatar_url":"https://avatars3.githubusercontent.com/u/10114717?v=4","gravatar_id":"","url":"https://api.github.com/users/takanakahiko","html_url":"https://github.com/takanakahiko","followers_url":"https://api.github.com/users/takanakahiko/followers","following_url":"https://api.github.com/users/takanakahiko/following{/other_user}","gists_url":"https://api.github.com/users/takanakahiko/gists{/gist_id}","starred_url":"https://api.github.com/users/takanakahiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takanakahiko/subscriptions","organizations_url":"https://api.github.com/users/takanakahiko/orgs","repos_url":"https://api.github.com/users/takanakahiko/repos","events_url":"https://api.github.com/users/takanakahiko/events{/privacy}","received_events_url":"https://api.github.com/users/takanakahiko/received_events","type":"User","site_admin":false},"created_at":"2018-11-10T02:11:02Z","updated_at":"2018-11-10T02:11:02Z","author_association":"CONTRIBUTOR","body":"I think that it is better to use `try/catch` for error handling.\r\n\r\nlike this.\r\n\r\n```js\r\ntry {\r\n  deployments = await script.projects.deployments.update({\r\n    scriptId,\r\n    deploymentId,\r\n    requestBody: {\r\n      deploymentConfig: {\r\n        versionNumber,\r\n        manifestFileName: PROJECT_MANIFEST_BASENAME,\r\n        description,\r\n      },\r\n    },\r\n  })\r\n}catch(err){\r\n  return logError(null, err.message);\r\n}\r\n```"}}
{"actor":{"display_login":"takanakahiko"}}