@@ -23,6 +23,7 @@ import { NotificationServiceServer } from '../common/protocol';
23
23
import { ArduinoCoreServiceClient } from './cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb' ;
24
24
import { firstToUpperCase , firstToLowerCase } from '../common/utils' ;
25
25
import { Port } from './cli-protocol/cc/arduino/cli/commands/v1/port_pb' ;
26
+ import { nls } from '@theia/core' ;
26
27
27
28
@injectable ( )
28
29
export class CoreServiceImpl extends CoreClientAware implements CoreService {
@@ -85,11 +86,16 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
85
86
chunk : '\n--------------------------\nCompilation complete.\n' ,
86
87
} ) ;
87
88
} catch ( e ) {
89
+ const errorMessage = nls . localize (
90
+ 'arduino/compile/error' ,
91
+ 'Compilation error: {0}' ,
92
+ e . details
93
+ ) ;
88
94
this . responseService . appendToOutput ( {
89
- chunk : `Compilation error: ${ e . details } \n` ,
95
+ chunk : `${ errorMessage } }\n` ,
90
96
severity : 'error' ,
91
97
} ) ;
92
- throw e ;
98
+ throw new Error ( errorMessage ) ;
93
99
}
94
100
}
95
101
@@ -180,11 +186,17 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
180
186
' complete.\n' ,
181
187
} ) ;
182
188
} catch ( e ) {
189
+ const errorMessage = nls . localize (
190
+ 'arduino/upload/error' ,
191
+ '{0} error: {1}' ,
192
+ firstToUpperCase ( task ) ,
193
+ e . details ,
194
+ ) ;
183
195
this . responseService . appendToOutput ( {
184
- chunk : `${ firstToUpperCase ( task ) } error: ${ e . details } \n` ,
196
+ chunk : `${ errorMessage } \n` ,
185
197
severity : 'error' ,
186
198
} ) ;
187
- throw e ;
199
+ throw new Error ( errorMessage ) ;
188
200
} finally {
189
201
this . uploading = false ;
190
202
}
@@ -227,11 +239,16 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
227
239
result . on ( 'end' , ( ) => resolve ( ) ) ;
228
240
} ) ;
229
241
} catch ( e ) {
242
+ const errorMessage = nls . localize (
243
+ 'arduino/burnBootloader/error' ,
244
+ 'Error while burning the bootloader: {0}' ,
245
+ e . details ,
246
+ ) ;
230
247
this . responseService . appendToOutput ( {
231
- chunk : `Error while burning the bootloader: ${ e . details } \n` ,
248
+ chunk : `${ errorMessage } \n` ,
232
249
severity : 'error' ,
233
250
} ) ;
234
- throw e ;
251
+ throw new Error ( errorMessage ) ;
235
252
}
236
253
}
237
254
0 commit comments