Skip to content

Commit

Permalink
update telemetry add error fields and category
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 committed Aug 6, 2024
1 parent b84b268 commit 599b8f0
Show file tree
Hide file tree
Showing 37 changed files with 94 additions and 66 deletions.
9 changes: 5 additions & 4 deletions src/build/buildCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,19 @@ export async function buildCommand(
workspace
) as string;
if (adapterTargetName !== "esp32s2" && adapterTargetName !== "esp32s3") {
return Logger.warnNotify(
Logger.warnNotify(
`The selected device target "${adapterTargetName}" is not compatible for DFU, as a result the DFU.bin was not created.`
);
} else {
await buildTask.buildDfu();
await TaskManager.runTasks();
}
await buildTask.buildDfu();
await TaskManager.runTasks();
}
if (!cancelToken.isCancellationRequested) {
updateIdfComponentsTree(workspace);
Logger.infoNotify("Build Successfully");
const flashCmd = await buildFinishFlashCmd(workspace);
OutputChannel.appendLineAndShow(flashCmd, "Build");
OutputChannel.appendLine(flashCmd, "Build");
TaskManager.disposeListeners();
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/build/buildTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class BuildTask {
} catch (error) {
const errorMessage =
"Failed to save unsaved files, ignoring and continuing with the build";
Logger.error(errorMessage, error);
Logger.error(errorMessage, error, "build saveBeforeBuild");
Logger.warnNotify(errorMessage);
}
if (BuildTask.isBuilding) {
Expand Down
2 changes: 1 addition & 1 deletion src/cdtDebugAdapter/debugConfProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class CDTDebugConfigurationProvider
const msg = error.message
? error.message
: "Some build files doesn't exist. Build this project first.";
Logger.error(msg, error);
Logger.error(msg, error, "CDTDebugConfigurationProvider");
return;
}
return config;
Expand Down
2 changes: 1 addition & 1 deletion src/checkExtensionSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function checkExtensionSettings(
const msg = error.message
? error.message
: "Checking if current install is valid throws an error.";
Logger.error(msg, error);
Logger.error(msg, error, "checkExtensionSettings");
}
const notificationMode = readParameter(
"idf.notificationMode",
Expand Down
2 changes: 1 addition & 1 deletion src/cmake/srcsWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class UpdateCmakeLists {
? error.message
: "Error updating srcs in CMakeLists.txt";
this.writeFinished();
Logger.error(msg, error);
Logger.error(msg, error, "updateSrcsInCmakeLists");
}
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/component-manager/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function addDependency(
{ dependency, component }
)
);
Logger.error(error.message, error);
Logger.error(error.message, error, "Component manager addDependency");
throw throwableError;
}
}
Expand Down Expand Up @@ -111,7 +111,7 @@ export async function createProject(
{ example }
)}. Original error: ${error.message}`
);
Logger.error(error.message, error);
Logger.error(error.message, error, "Component manager createProject");
throw throwableError;
}
}
3 changes: 2 additions & 1 deletion src/coverage/coverageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export async function generateCoverageForEditors(
"Error generate editor coverage.\n" +
"Check the ESP-IDF output for more details." +
msg,
error
error,
"coverageService generateCoverageForEditors"
);
OutputChannel.appendLine(
msg +
Expand Down
2 changes: 1 addition & 1 deletion src/coverage/gcdaPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function getGcovData(workspaceFolder: Uri) {
(err, stdout, stderr) => {
if (err) {
const msg = err && err.message ? err.message : err;
Logger.error(`exec error: ${msg}`, err);
Logger.error(`exec error: ${msg}`, err, "gcdaPaths getGcovData");
return reject(err);
}
const output = [];
Expand Down
2 changes: 1 addition & 1 deletion src/downloadManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class DownloadManager {
const errMsg = error.message
? error.message
: `Error downloading ${urlToUse}`;
Logger.error(errMsg, error);
Logger.error(errMsg, error, "downloadManager downloadWithRetries");
retryCount += 1;
if (cancelToken && cancelToken.isCancellationRequested) {
throw error;
Expand Down
2 changes: 1 addition & 1 deletion src/efuse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class ESPEFuseManager {
);
const eFuseFields = await readJson(tempFile);
unlink(tempFile, (err) => {
Logger.error("Failed to delete the tmp espfuse json file", err);
Logger.error("Failed to delete the tmp espfuse json file", err, "ESPEFuseManager summary");
});
const resp = {};
for (const name in eFuseFields) {
Expand Down
2 changes: 1 addition & 1 deletion src/espIdf/core-dump/esp-core-dump-py-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class ESPCoreDumpPyTool {
);
return true;
} catch (error) {
Logger.error("espcoredump.py failed", error, { output: resp.toString() });
Logger.error("espcoredump.py failed", error, "ESPCoreDumpPyTool generateCoreELFFile", { output: resp.toString() });
return false;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/espIdf/documentation/getDocsVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export async function getDocsVersion() {
} catch (error) {
Logger.error(
`Error parsing object from ${ESP.URL.Docs.IDF_VERSIONS}`,
error
error,
"getDocsVersion"
);
}
}
Expand All @@ -65,7 +66,7 @@ export function getDocsLocaleLang() {
const localeConf = JSON.parse(process.env.VSCODE_NLS_CONFIG);
localeLang = localeConf.locale === "zh-CN" ? "zh_CN" : "en";
} catch (error) {
Logger.error("Error getting current vscode language", error);
Logger.error("Error getting current vscode language", error, "getDocsVersion getDocsLocaleLang");
}
return localeLang;
}
Expand Down
4 changes: 2 additions & 2 deletions src/espIdf/menuconfig/MenuconfigPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class MenuConfigPanel {
const err = new Error(
`Menuconfig: Unrecognized command received, file: ${__filename}`
);
Logger.error(err.message, err);
Logger.error(err.message, err, "MenuconfigPanel Unrecognized command");
break;
}
});
Expand All @@ -226,7 +226,7 @@ export class MenuConfigPanel {

if (jsonValues.error) {
const err = new Error(`Invalid data error: ${jsonValues.error}`);
Logger.error(err.message, err);
Logger.error(err.message, err, "MenuconfigPanel updateConfigValues");
return;
}
const updatedMenus = ConfserverProcess.updateValues(values);
Expand Down
4 changes: 2 additions & 2 deletions src/espIdf/menuconfig/confServerProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class ConfserverProcess {
if (code !== 0) {
const errorMsg = `When loading default values received exit signal: ${signal}, code : ${code}`;
OutputChannel.appendLine(errorMsg, "SDK Configuration Editor");
Logger.error(errorMsg, new Error(errorMsg));
Logger.error(errorMsg, new Error(errorMsg), "ConfserverProcess setDefaultValues");
}
ConfserverProcess.init(currWorkspace, extensionPath);
progress.report({ increment: 70, message: "The end" });
Expand Down Expand Up @@ -425,6 +425,6 @@ export class ConfserverProcess {
OutputChannel.appendLine(
"-----------------------END OF ERROR-----------------------"
);
Logger.error(data.toString(), new Error(data.toString()));
Logger.error(data.toString(), new Error(data.toString()), "ConfserverProcess printError");
}
}
2 changes: 1 addition & 1 deletion src/espIdf/monitor/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function createNewIdfMonitor(
try {
await commands.executeCommand("espIdf.selectPort");
} catch (error) {
Logger.error("Unable to execute the command: espIdf.selectPort", error);
Logger.error("Unable to execute the command: espIdf.selectPort", error, "command createNewIdfMonitor");
}
Logger.errorNotify(
"Select a serial port before flashing",
Expand Down
4 changes: 2 additions & 2 deletions src/espIdf/openOcd/boardConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function getOpenOcdScripts(workspace: Uri): string {
? process.env.OPENOCD_SCRIPTS
: undefined;
} catch (error) {
Logger.error(error.message, error);
Logger.error(error.message, error, "boardConfiguration getOpenOcdScripts");
openOcdScriptsPath = process.env.OPENOCD_SCRIPTS
? process.env.OPENOCD_SCRIPTS
: undefined;
Expand Down Expand Up @@ -92,7 +92,7 @@ export async function getBoards(
});
return idfTarget ? filteredEspBoards : espBoards;
} catch (error) {
Logger.error(error.message, error);
Logger.error(error.message, error, "boardConfiguration getBoards");
const filteredDefaultBoards = defaultBoards.filter((b) => {
return b.target === idfTarget;
});
Expand Down
6 changes: 3 additions & 3 deletions src/espIdf/openOcd/openOcdManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class OpenOCDManager extends EventEmitter {
}
} catch (error) {
const msg = error.message ? error.message : JSON.stringify(error);
Logger.error(msg, error);
Logger.error(msg, error, "OpenOCDManager commandHandler");
OutputChannel.appendLine(msg, "OpenOCD");
}
return true;
Expand Down Expand Up @@ -218,7 +218,7 @@ export class OpenOCDManager extends EventEmitter {
" "
)}`;
const err = new Error(errorMsg);
Logger.error(errorMsg + `\n❌ ${errStr}`, err);
Logger.error(errorMsg + `\n❌ ${errStr}`, err, "OpenOCDManager stderr");
OutputChannel.appendLine(`❌ ${errStr}`, "OpenOCD");
this.emit("error", err, this.chan);
}
Expand All @@ -245,7 +245,7 @@ export class OpenOCDManager extends EventEmitter {
if (!signal && code && code !== 0) {
Logger.error(
`OpenOCD Exit with non-zero error code ${code}`,
new Error("Spawn exit with non-zero" + code)
new Error("Spawn exit with non-zero" + code), "OpenOCDManager close"
);
OutputChannel.appendLine(
`OpenOCD Exit with non-zero error code ${code}`,
Expand Down
2 changes: 1 addition & 1 deletion src/espIdf/size/idfSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class IDFSize {
const throwableError = new Error(
vscode.l10n.t("Error encountered while calling idf_size.py")
);
Logger.error(error.message, error);
Logger.error(error.message, error, "IDFSize idfCommandInvoker");
throw throwableError;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/espIdf/size/idfSizePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class IDFSizePanel {
const err = new Error(
`Unrecognized command received from webview (idf-size), file: ${__filename}`
);
Logger.error(err.message, err);
Logger.error(err.message, err, "IDFSizePanel unrecognized command");
break;
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/espIdf/tracing/appTraceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ export class AppTraceManager extends EventEmitter {
tclClient.on("error", (error: Error) => {
Logger.error(
`Some error prevailed while checking the tracking status`,
error
error,
"AppTraceManager appTracingStatusChecker"
);
this.shallContinueCheckingStatus = false;
onStop();
Expand Down
2 changes: 1 addition & 1 deletion src/espIdf/tracing/appTracePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class AppTracePanel {
const err = new Error(
`Unrecognized command received from webview (idf-trace) file: ${__filename}`
);
Logger.error(err.message, err);
Logger.error(err.message, err, "AppTracePanel unrecognized command");
break;
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/espIdf/unitTest/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function configurePyTestUnitApp(
? error.message
: "Error configuring PyTest Unit App for project";
OutputChannel.appendLine(msg, "idf-unit-test");
Logger.error(msg, error);
Logger.error(msg, error, "configurePyTestUnitApp");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/espIdf/unitTest/testExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function runPyTestWithTestCase(
? error.message
: "Error configuring PyTest Unit App for project";
OutputChannel.appendLine(msg, "idf-unit-test");
Logger.error(msg, error);
Logger.error(msg, error, "runPyTestWithTestCase");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/examples/ExamplesPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class ExamplesPlanel {
vscode.commands.executeCommand("vscode.openFolder", projectPath);
} catch (error) {
const msg = `Error copying ESP-IDF example.`;
Logger.error(msg, error);
Logger.error(msg, error, "ExamplesPanel copyFromSrcProject");
const opt = await vscode.window.showErrorMessage(
msg,
"Show Docs",
Expand Down
19 changes: 12 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ export async function activate(context: vscode.ExtensionContext) {
? error.message
: "Error checking PyTest python packages";
OutputChannel.appendLine(msg, "idf-unit-test");
Logger.error(msg, error);
Logger.error(msg, error, "extension checkPytestRequirements");
}

const notificationMode = idfConf.readParameter(
Expand Down Expand Up @@ -1592,7 +1592,7 @@ export async function activate(context: vscode.ExtensionContext) {
? error.message
: "Error installing PyTest python packages";
OutputChannel.appendLine(msg, "idf-unit-test");
Logger.error(msg, error);
Logger.error(msg, error, "extension installPyTestPackages");
}
}
);
Expand Down Expand Up @@ -1643,7 +1643,7 @@ export async function activate(context: vscode.ExtensionContext) {
? error.message
: "Error build or flashing PyTest Unit App for project";
OutputChannel.appendLine(msg, "idf-unit-test");
Logger.error(msg, error);
Logger.error(msg, error, "extension buildFlashTestApp");
}
}
);
Expand Down Expand Up @@ -2196,7 +2196,7 @@ export async function activate(context: vscode.ExtensionContext) {
if (buildProject === "Build") {
vscode.commands.executeCommand("espIdf.buildDevice");
}
Logger.error(msg, error);
Logger.error(msg, error, "extension IDFSizePanel");
return;
}
Logger.errorNotify(error.message, error);
Expand Down Expand Up @@ -2582,7 +2582,7 @@ export async function activate(context: vscode.ExtensionContext) {
const errMsg = error.message
? error.message
: "Configuration report error";
Logger.error(errMsg, error);
Logger.error(errMsg, error, "extension DoctorCommand");
Logger.warnNotify(
vscode.l10n.t(
"Extension configuration report has been copied to clipboard with errors"
Expand Down Expand Up @@ -2945,7 +2945,8 @@ export async function activate(context: vscode.ExtensionContext) {
} catch (error) {
Logger.error(
vscode.l10n.t("Unable to execute the command: espIdf.selectPort"),
error
error,
"extension launchWSServerAndMonitor selectPort"
);
}
return Logger.errorNotify(
Expand Down Expand Up @@ -4239,7 +4240,11 @@ class IdfDebugConfigurationProvider
const msg = error.message
? error.message
: "Some build files doesn't exist. Build this project first.";
Logger.error(error.message, error);
Logger.error(
error.message,
error,
"extension IdfDebugConfigurationProvider"
);
const startBuild = await vscode.window.showInformationMessage(
msg,
"Build"
Expand Down
2 changes: 1 addition & 1 deletion src/flash/flashCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function verifyCanFlash(
const errStr = "Unable to execute the command: espIdf.selectPort";
OutputChannel.show();
OutputChannel.appendLineAndShow(errStr, "Flash");
Logger.error(errStr, error);
Logger.error(errStr, error, "verifyCanFlash selectPort");
}
const errStr = "Select a port before flashing";
OutputChannel.show();
Expand Down
2 changes: 1 addition & 1 deletion src/idfToolsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class IdfToolsManager {
this.toolsManagerChannel.appendLine(errMsg);
this.toolsManagerChannel.appendLine(error);
}
Logger.error(errMsg, error);
Logger.error(errMsg, error, "IdfToolsManager checkBinariesVersion");
return errMsg;
}
}
Expand Down
Loading

0 comments on commit 599b8f0

Please sign in to comment.