30
30
import { BehaviorSubject } from 'rxjs' ;
31
31
import { takeUntil , filter , first } from 'rxjs/operators' ;
32
32
import { provisioningSketch } from './sketches/provisioning.ino' ;
33
+ import { read } from 'fs' ;
33
34
34
35
const BAUDRATE = 9600 ;
35
36
@@ -155,7 +156,11 @@ export default class BoardConfiguration {
155
156
this . configuring . next ( { status : this . CONFIGURE_IN_PROGRESS , msg : 'Starting board configuration' } ) ;
156
157
if ( ! this . daemon . channelOpen . getValue ( ) ) {
157
158
const errorMessage = `Couldn't configure board at port ${ board . port } because we there is no open channel to the Arduino Create Plugin.` ;
158
- this . configuring . next ( { status : this . CONFIGURE_ERROR , err : errorMessage } ) ;
159
+ this . configuring . next ( {
160
+ status : this . CONFIGURE_ERROR ,
161
+ msg : errorMessage ,
162
+ err : 'cannot find plugin'
163
+ } ) ;
159
164
return ;
160
165
}
161
166
this . serialMonitorContent = '' ;
@@ -186,7 +191,11 @@ export default class BoardConfiguration {
186
191
// check the uploading status:
187
192
if ( this . daemon . uploading . getValue ( ) . status === this . daemon . UPLOAD_IN_PROGRESS ) {
188
193
// if there is an upload in course, notify observers;
189
- this . configuring . next ( { status : this . CONFIGURE_ERROR , err : `Couldn't configure board at port ${ board . port } . There is already an upload in progress.` } ) ;
194
+ this . configuring . next ( {
195
+ status : this . CONFIGURE_ERROR ,
196
+ msg : `Couldn't configure board at port ${ board . port } . There is already an upload in progress.` ,
197
+ err : `upload in progress`
198
+ } ) ;
190
199
return ;
191
200
}
192
201
@@ -199,9 +208,16 @@ export default class BoardConfiguration {
199
208
. then ( ( ) => this . configuring . next ( { status : this . CONFIGURE_DONE } ) )
200
209
. catch ( reason => this . configuring . next ( {
201
210
status : this . CONFIGURE_ERROR ,
202
- err : `Couldn't configure board at port ${ board . port } . Configuration failed with error: ${ reason } `
211
+ msg : `Couldn't configure board at port ${ board . port } . Configuration failed with error: ${ reason } ` ,
212
+ err : reason . toString ( )
203
213
} ) )
204
214
. finally ( ( ) => this . daemon . closeSerialMonitor ( board . port , BAUDRATE ) ) ;
215
+ } , error => {
216
+ this . configuring . next ( {
217
+ status : this . CONFIGURE_ERROR ,
218
+ msg : `Couldn't configure board at port ${ board . port } . Configuration failed with error: ${ error } ` ,
219
+ err : error . toString ( )
220
+ } ) ;
205
221
} ) ;
206
222
this . daemon . openSerialMonitor ( board . port , BAUDRATE ) ;
207
223
} ) ;
0 commit comments