Skip to content

Commit fca9e12

Browse files
authored
Merge pull request #320 from creatorsim/master
Gateway error message added
2 parents a88b11e + 1708938 commit fca9e12

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

components/simulator/creator_uielto_target_flash.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@
278278
this_env = this;
279279
gateway_remote_flash(this.flash_url + "/flash", farg).then( function(data) {
280280
this_env.flashing = false;
281-
console.log(JSON.stringify(data, null, 2));
281+
console.log("Message:"+ JSON.stringify(data, null, 2));
282+
if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) {
283+
show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger');
284+
}
282285
if (JSON.stringify(data, null, 2).includes('Flash completed successfully')) {
283286
show_notification('Flashing program success.', 'success');
284287
}
@@ -308,6 +311,9 @@
308311
this_env.stoprunning = false;
309312
//show_notification(data, 'danger') ;
310313
console.log(JSON.stringify(data, null, 2));
314+
if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) {
315+
show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger');
316+
}
311317
if (JSON.stringify(data, null, 2).includes('Process stopped')) {
312318
show_notification('Process stopped.', 'success');
313319
}
@@ -336,6 +342,9 @@
336342
gateway_remote_monitor(this.flash_url + "/monitor", farg).then( function(data) {
337343
this_env.running = false;
338344
console.log(JSON.stringify(data, null, 2));
345+
if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) {
346+
show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger');
347+
}
339348
if (JSON.stringify(data, null, 2).includes('No UART port found')) {
340349
show_notification('Error: Not found UART port', 'danger');
341350
}
@@ -362,7 +371,10 @@
362371

363372
this_env = this;
364373
gateway_remote_monitor(this.flash_url + "/debug", farg).then( function(data) {
365-
this_env.debugging = false;
374+
this_env.debugging = false;
375+
if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) {
376+
show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger');
377+
}
366378
if (JSON.stringify(data, null, 2).includes('No ELF file found in build directory')) {
367379
show_notification('Error: Not found proyect to debug', 'danger');
368380
}
@@ -378,6 +390,8 @@
378390
creator_ga('simulator', 'simulator.debug', 'simulator.debug');
379391
},
380392

393+
394+
381395
showConfirmPopup(action) {
382396
this.pendingAction = action;
383397
this.showPopup = true;
@@ -408,6 +422,9 @@
408422
this_env = this;
409423
gateway_remote_monitor(this.flash_url + "/fullclean", farg).then( function(data) {
410424
this_env.fullclean = false;
425+
if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) {
426+
show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger');
427+
}
411428
console.log(JSON.stringify(data, null, 2));
412429
if (JSON.stringify(data, null, 2).includes('Full clean done.')) {
413430
show_notification('Full clean done.', 'success');
@@ -438,6 +455,9 @@
438455
this_env.eraseflash = false;
439456
//show_notification(data, 'danger') ;
440457
console.log(JSON.stringify(data, null, 2));
458+
if (JSON.stringify(data, null, 2).includes('TypeError: NetworkError')) {
459+
show_notification('Gateway not available at the moment. Please, execute python3 gateway.py, heck if port 8080 works fine and connect your board first\n', 'danger');
460+
}
441461
if (JSON.stringify(data, null, 2).includes('Erase flash done')) {
442462
show_notification('Erase flash done. Please, unplug and plug the cable(s) again', 'success');
443463
}

0 commit comments

Comments
 (0)