Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5ddab1d

Browse files
Remove gRPC error code from error notifications
1 parent f0d9894 commit 5ddab1d

File tree

5 files changed

+53
-9
lines changed

5 files changed

+53
-9
lines changed

‎arduino-ide-extension/src/browser/contributions/burn-bootloader.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ export class BurnBootloader extends SketchContribution {
7979
}
8080
);
8181
} catch (e) {
82-
this.messageService.error(e.toString());
82+
let errorMessage = "";
83+
if (typeof e === "string") {
84+
errorMessage = e;
85+
} else {
86+
errorMessage = e.toString();
87+
}
88+
this.messageService.error(errorMessage);
8389
} finally {
8490
if (this.serialConnection.isSerialOpen()) {
8591
await this.serialConnection.connect();

‎arduino-ide-extension/src/browser/contributions/upload-sketch.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,13 @@ export class UploadSketch extends SketchContribution {
277277
{ timeout: 3000 }
278278
);
279279
} catch (e) {
280-
this.messageService.error(e.toString());
280+
let errorMessage = "";
281+
if (typeof e === "string") {
282+
errorMessage = e;
283+
} else {
284+
errorMessage = e.toString();
285+
}
286+
this.messageService.error(errorMessage);
281287
} finally {
282288
this.uploadInProgress = false;
283289
this.onDidChangeEmitter.fire();

‎arduino-ide-extension/src/browser/contributions/verify-sketch.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ export class VerifySketch extends SketchContribution {
127127
{ timeout: 3000 }
128128
);
129129
} catch (e) {
130-
this.messageService.error(e.toString());
130+
let errorMessage = "";
131+
if (typeof e === "string") {
132+
errorMessage = e;
133+
} else {
134+
errorMessage = e.toString();
135+
}
136+
this.messageService.error(errorMessage);
131137
} finally {
132138
this.verifyInProgress = false;
133139
this.onDidChangeEmitter.fire();

‎arduino-ide-extension/src/node/core-service-impl.ts‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { NotificationServiceServer } from '../common/protocol';
2323
import { ArduinoCoreServiceClient } from './cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb';
2424
import { firstToUpperCase, firstToLowerCase } from '../common/utils';
2525
import { Port } from './cli-protocol/cc/arduino/cli/commands/v1/port_pb';
26+
import { nls } from '@theia/core';
2627

2728
@injectable()
2829
export class CoreServiceImpl extends CoreClientAware implements CoreService {
@@ -85,11 +86,16 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
8586
chunk: '\n--------------------------\nCompilation complete.\n',
8687
});
8788
} catch (e) {
89+
const errorMessage = nls.localize(
90+
'arduino/compile/error',
91+
'Compilation error: {0}',
92+
e.details
93+
);
8894
this.responseService.appendToOutput({
89-
chunk: `Compilation error: ${e.details}\n`,
95+
chunk: `${errorMessage}}\n`,
9096
severity: 'error',
9197
});
92-
throw e;
98+
throw newError(errorMessage);
9399
}
94100
}
95101

@@ -180,11 +186,17 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
180186
' complete.\n',
181187
});
182188
} catch (e) {
189+
const errorMessage = nls.localize(
190+
'arduino/upload/error',
191+
'{0} error: {1}',
192+
firstToUpperCase(task),
193+
e.details,
194+
);
183195
this.responseService.appendToOutput({
184-
chunk: `${firstToUpperCase(task)} error: ${e.details}\n`,
196+
chunk: `${errorMessage}\n`,
185197
severity: 'error',
186198
});
187-
throw e;
199+
throw newError(errorMessage);
188200
} finally {
189201
this.uploading = false;
190202
}
@@ -227,11 +239,16 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
227239
result.on('end', () => resolve());
228240
});
229241
} catch (e) {
242+
const errorMessage = nls.localize(
243+
'arduino/burnBootloader/error',
244+
'Error while burning the bootloader: {0}',
245+
e.details,
246+
);
230247
this.responseService.appendToOutput({
231-
chunk: `Error while burning the bootloader: ${e.details}\n`,
248+
chunk: `${errorMessage}\n`,
232249
severity: 'error',
233250
});
234-
throw e;
251+
throw newError(errorMessage);
235252
}
236253
}
237254

‎i18n/en.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,15 @@
288288
"electron": {
289289
"couldNotSave": "Could not save the sketch. Please copy your unsaved work into your favorite text editor, and restart the IDE.",
290290
"unsavedChanges": "Any unsaved changes will not be saved."
291+
},
292+
"compile": {
293+
"error": "Compilation error: {0}"
294+
},
295+
"upload": {
296+
"error": "{0} error: {1}"
297+
},
298+
"burnBootloader": {
299+
"error": "Error while burning the bootloader: {0}"
291300
}
292301
},
293302
"theia": {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /