{"action":"created","issue":{"url":"https://api.github.com/repos/tessel/ambient-attx4/issues/63","repository_url":"https://api.github.com/repos/tessel/ambient-attx4","labels_url":"https://api.github.com/repos/tessel/ambient-attx4/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/tessel/ambient-attx4/issues/63/comments","events_url":"https://api.github.com/repos/tessel/ambient-attx4/issues/63/events","html_url":"https://github.com/tessel/ambient-attx4/issues/63","id":151507335,"number":63,"title":"Enhance Tessel port detection logic","user":{"login":"wyze","id":186971,"avatar_url":"https://avatars.githubusercontent.com/u/186971?v=3","gravatar_id":"","url":"https://api.github.com/users/wyze","html_url":"https://github.com/wyze","followers_url":"https://api.github.com/users/wyze/followers","following_url":"https://api.github.com/users/wyze/following{/other_user}","gists_url":"https://api.github.com/users/wyze/gists{/gist_id}","starred_url":"https://api.github.com/users/wyze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyze/subscriptions","organizations_url":"https://api.github.com/users/wyze/orgs","repos_url":"https://api.github.com/users/wyze/repos","events_url":"https://api.github.com/users/wyze/events{/privacy}","received_events_url":"https://api.github.com/users/wyze/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-27T22:33:22Z","updated_at":"2016-04-29T19:55:11Z","closed_at":null,"body":"As it is currently, this is what is used:\r\n\r\n```js\r\nfunction use(hardware, callback) {\r\n  if (!hardware) {\r\n    console.warn(new Error('Improperly specified Tessel port.'));\r\n  }\r\n\r\n  return new Ambient(hardware, callback);\r\n}\r\n```\r\n\r\n1. Why `console.warn` instead of `throw`? If it does warn, it is going to throw somewhere else, we should give feedback as early as possible.\r\n\r\n2. Can this check be moved into the `Ambient` function to also catch rare cases where someone is not using the `use` function and just `Ambient` directly?\r\n\r\n3. ~~I think the logic needs to change to be a little more robust. Right now, it just checks to see if the value is truthy, so it won't go into the `if` statement if say I do something like `var ambient = ambientlib.use(true);`. I think if tessel/t2-firmware#172 could land we can do a lot better here.~~\r\n"},"comment":{"url":"https://api.github.com/repos/tessel/ambient-attx4/issues/comments/215862149","html_url":"https://github.com/tessel/ambient-attx4/issues/63#issuecomment-215862149","issue_url":"https://api.github.com/repos/tessel/ambient-attx4/issues/63","id":215862149,"user":{"login":"wyze","id":186971,"avatar_url":"https://avatars.githubusercontent.com/u/186971?v=3","gravatar_id":"","url":"https://api.github.com/users/wyze","html_url":"https://github.com/wyze","followers_url":"https://api.github.com/users/wyze/followers","following_url":"https://api.github.com/users/wyze/following{/other_user}","gists_url":"https://api.github.com/users/wyze/gists{/gist_id}","starred_url":"https://api.github.com/users/wyze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyze/subscriptions","organizations_url":"https://api.github.com/users/wyze/orgs","repos_url":"https://api.github.com/users/wyze/repos","events_url":"https://api.github.com/users/wyze/events{/privacy}","received_events_url":"https://api.github.com/users/wyze/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T19:55:11Z","updated_at":"2016-04-29T19:55:11Z","body":"> I'm a fan of \"fail early and hard\", but I think that ship has sailed here? You could update it to throw, and if anyone ever files an issue, dial it back. WDYT?\r\n\r\nI think that would work. I think if they see this warning, they are going to run into other issues with not being able to communicate with the port."}}