Skip to content

Throwing an error when device is not found #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
# arduino-create-agent-js-client
JS module providing discovery of the [Arduino Create Agent](https://github.com/arduino/arduino-create-agent) and communication with it


## Changelog
[2.9.0] - 2022-06-06
[2.9.1-alpha.2] - 2022-08-17

### Changed
- The error `No device found` coming from the `arduino-create-agent` is now treated as an error.

## Changelog
[2.9.1-alpha.1] - 2022-07-28

### Added
- Added support for ESP boards (experimental)

## Changelog
[2.9.0] - 2022-06-06
### Added
- Added support for "Arduino RP2040 Connect" board
### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arduino-create-agent-js-client",
"version": "2.9.0",
"version": "2.9.1-alpha.2",
"description": "JS module providing discovery of the Arduino Create Plugin and communication with it",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class Daemon {
})
.then(result => result.json())
.then(uploadCommandInfo => {
const projectNameIndex = uploadCommandInfo.commandline.indexOf('{build.project_name}');
const projectNameIndex = uploadCommandInfo.commandline.lastIndexOf('{build.project_name}');
let ext = uploadCommandInfo.commandline.substring(projectNameIndex + 21, projectNameIndex + 24);
const data = compilationResult[ext] || compilationResult.bin;
if (!ext || !data) {
Expand Down
7 changes: 6 additions & 1 deletion src/socket-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,12 @@ export default class SocketDaemon extends Daemon {
this.uploading.next({ status: this.UPLOAD_IN_PROGRESS, msg: `Programming with: ${message.Cmd}` });
break;
case 'Busy':
this.uploading.next({ status: this.UPLOAD_IN_PROGRESS, msg: message.Msg });
if (message.Msg && message.Msg.indexOf('No device found') === 0) {
this.uploading.next({ status: this.UPLOAD_ERROR, err: message.Msg });
}
else {
this.uploading.next({ status: this.UPLOAD_IN_PROGRESS, msg: message.Msg });
}
break;
case 'Error':
this.uploading.next({ status: this.UPLOAD_ERROR, err: message.Msg });
Expand Down