@@ -23,6 +23,7 @@ import { ArduinoWorkspace } from "../common/workspace";
23
23
import { SerialMonitor } from "../serialmonitor/serialMonitor" ;
24
24
import { UsbDetector } from "../serialmonitor/usbDetector" ;
25
25
import { ProgrammerManager } from "./programmerManager" ;
26
+ import { messages } from './../common/constants' ;
26
27
27
28
/**
28
29
* Represent an Arduino application based on the official Arduino IDE.
@@ -133,7 +134,7 @@ export class ArduinoApp {
133
134
const prebuildargs = dc . prebuild . split ( " " ) ;
134
135
const prebuildCommand = prebuildargs . shift ( ) ;
135
136
try {
136
- await util . spawn ( prebuildCommand , arduinoChannel . channel , prebuildargs , { shell : true , cwd : ArduinoWorkspace . rootPath } ) ;
137
+ await util . spawn ( prebuildCommand , arduinoChannel . channel , prebuildargs , { shell : true , cwd : ArduinoWorkspace . rootPath } ) ;
137
138
} catch ( ex ) {
138
139
arduinoChannel . error ( `Run prebuild failed: \n${ ex . error } ` ) ;
139
140
return ;
@@ -215,7 +216,7 @@ export class ArduinoApp {
215
216
216
217
const appPath = path . join ( ArduinoWorkspace . rootPath , dc . sketch ) ;
217
218
const args = [ "--upload" , "--board" , boardDescriptor , "--port" , dc . port , "--useprogrammer" ,
218
- "--pref" , "programmer=" + selectProgrammer , appPath ] ;
219
+ "--pref" , "programmer=" + selectProgrammer , appPath ] ;
219
220
if ( VscodeSettings . getInstance ( ) . logLevel === "verbose" ) {
220
221
args . push ( "--verbose" ) ;
221
222
}
@@ -269,7 +270,7 @@ export class ArduinoApp {
269
270
const prebuildargs = dc . prebuild . split ( " " ) ;
270
271
const prebuildCommand = prebuildargs . shift ( ) ;
271
272
try {
272
- await util . spawn ( prebuildCommand , arduinoChannel . channel , prebuildargs , { shell : true , cwd : ArduinoWorkspace . rootPath } ) ;
273
+ await util . spawn ( prebuildCommand , arduinoChannel . channel , prebuildargs , { shell : true , cwd : ArduinoWorkspace . rootPath } ) ;
273
274
} catch ( ex ) {
274
275
arduinoChannel . error ( `Run prebuild failed: \n${ ex . error } ` ) ;
275
276
return ;
@@ -303,7 +304,12 @@ export class ArduinoApp {
303
304
arduinoChannel . end ( `Finished verify sketch - ${ dc . sketch } ${ os . EOL } ` ) ;
304
305
return true ;
305
306
} catch ( reason ) {
306
- arduinoChannel . error ( `Exit with code=${ reason . code } ${ os . EOL } ` ) ;
307
+ const msg = reason . code ?
308
+ `Exit with code=${ reason . code } ${ os . EOL } ` :
309
+ reason . message ?
310
+ reason . message :
311
+ JSON . stringify ( reason ) ;
312
+ arduinoChannel . error ( msg ) ;
307
313
return false ;
308
314
}
309
315
@@ -315,7 +321,7 @@ export class ArduinoApp {
315
321
return ;
316
322
}
317
323
const cppConfigFile = fs . readFileSync ( configFilePath , "utf8" ) ;
318
- const cppConfig = JSON . parse ( cppConfigFile ) as { configurations : Array < { includePath : string [ ] , forcedInclude : string [ ] } > } ;
324
+ const cppConfig = JSON . parse ( cppConfigFile ) as { configurations : Array < { includePath : string [ ] , forcedInclude : string [ ] } > } ;
319
325
const libPaths = this . getDefaultPackageLibPaths ( ) ;
320
326
const defaultForcedInclude = this . getDefaultForcedIncludeFiles ( ) ;
321
327
const configuration = cppConfig . configurations [ 0 ] ;
0 commit comments