Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing error messages with error class #277

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import software.aws.toolkits.eclipse.amazonq.chat.models.TriggerType;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.telemetry.ToolkitTelemetryProvider;
import software.aws.toolkits.eclipse.amazonq.telemetry.metadata.ExceptionMetadata;
import software.aws.toolkits.eclipse.amazonq.util.QEclipseEditorUtils;
import software.aws.toolkits.eclipse.amazonq.views.ViewVisibilityManager;
import software.aws.toolkits.telemetry.TelemetryDefinitions.Result;
Expand Down Expand Up @@ -47,7 +48,7 @@ protected final void executeGenericCommand(final String genericCommandVerb) {
}
);
} catch (Exception e) {
emitExecuteCommand(genericCommandVerb, start, Result.FAILED, e.getMessage());
emitExecuteCommand(genericCommandVerb, start, Result.FAILED, ExceptionMetadata.scrubException("Error executing command", e));
Activator.getLogger().error(String.format("Error executing Amazon Q %s command", genericCommandVerb), e);
}
}
Expand All @@ -68,6 +69,7 @@ protected final void executeSendToPromptCommand() {
);
} catch (Exception e) {
Activator.getLogger().error("Error executing Amazon Q send to prompt command", e);
emitExecuteCommand("sendToPrompt", start, Result.FAILED, ExceptionMetadata.scrubException("Error executing command", e));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import software.aws.toolkits.eclipse.amazonq.util.AutoTriggerTopLevelListener;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.telemetry.ToolkitTelemetryProvider;
import software.aws.toolkits.eclipse.amazonq.telemetry.metadata.ExceptionMetadata;
import software.aws.toolkits.eclipse.amazonq.util.ProxyUtil;
import software.aws.toolkits.eclipse.amazonq.views.ViewConstants;
import software.aws.toolkits.eclipse.amazonq.util.ToolkitNotification;
Expand Down Expand Up @@ -100,7 +101,7 @@ public void run() {
}
} catch (PartInitException e) {
Activator.getLogger().warn("Error occurred during auto loading of plugin", e);
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, "firstStartUp", e.getMessage());
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, "firstStartUp", ExceptionMetadata.scrubException("Plugin load error", e));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import software.aws.toolkits.eclipse.amazonq.lsp.manager.fetcher.RecordLspSetupArgs;
import software.aws.toolkits.eclipse.amazonq.providers.LspManagerProvider;
import software.aws.toolkits.eclipse.amazonq.telemetry.LanguageServerTelemetryProvider;
import software.aws.toolkits.eclipse.amazonq.telemetry.metadata.ExceptionMetadata;
import software.aws.toolkits.telemetry.TelemetryDefinitions.Result;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;

Expand Down Expand Up @@ -58,11 +59,11 @@ public final void start() throws IOException {

lspEncryption.initializeEncryptedCommunication(serverStdIn);
} catch (Exception e) {
emitInitFailure(e.getMessage());
emitInitFailure(ExceptionMetadata.scrubException(e));
Activator.getLogger().error("Error occured while initializing communication with Amazon Q Lsp Server", e);
}
} catch (Exception e) {
emitInitFailure(e.getMessage());
emitInitFailure(ExceptionMetadata.scrubException(e));
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import software.aws.toolkits.eclipse.amazonq.util.PluginArchitecture;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.telemetry.LanguageServerTelemetryProvider;
import software.aws.toolkits.eclipse.amazonq.telemetry.metadata.ExceptionMetadata;
import software.aws.toolkits.eclipse.amazonq.util.PluginPlatform;
import software.aws.toolkits.eclipse.amazonq.util.PluginUtils;
import software.aws.toolkits.eclipse.amazonq.util.ThreadingUtils;
Expand Down Expand Up @@ -122,7 +123,7 @@ private boolean hasValidResult(final LspInstallResult overrideResult) {
validateLsp(overrideResult);
} catch (Exception e) {
Activator.getLogger().error(e.getMessage(), e);
errorMessage = e.getMessage();
errorMessage = ExceptionMetadata.scrubException(e);
} finally {
emitValidate(overrideResult, errorMessage, start);
}
Expand Down Expand Up @@ -190,7 +191,7 @@ private void validateAndConfigureLsp(final LspInstallResult result) throws IOExc
var nodeExecutable = serverDirPath.resolve(result.getServerCommand());
makeExecutable(nodeExecutable);
} catch (Exception e) {
errorMessage = e.getMessage();
errorMessage = ExceptionMetadata.scrubException(e);
throw e;
} finally {
emitValidate(result, errorMessage, start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import software.aws.toolkits.eclipse.amazonq.chat.ChatStateManager;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.telemetry.ToolkitTelemetryProvider;
import software.aws.toolkits.eclipse.amazonq.telemetry.metadata.ExceptionMetadata;

public final class ViewVisibilityManager {
private ViewVisibilityManager() {
Expand Down Expand Up @@ -92,7 +93,7 @@ private static void showMutuallyExclusiveView(final String viewId, final String
ToolkitTelemetryProvider.emitCloseModuleEventMetric(viewRef.getId(), "none");
} catch (Exception e) {
Activator.getLogger().error("Error occurred while hiding view " + viewId, e);
ToolkitTelemetryProvider.emitCloseModuleEventMetric(viewRef.getId(), e.getMessage());
ToolkitTelemetryProvider.emitCloseModuleEventMetric(viewRef.getId(), ExceptionMetadata.scrubException(e));
}
}
}
Expand All @@ -102,7 +103,7 @@ private static void showMutuallyExclusiveView(final String viewId, final String
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, source, "none");
} catch (Exception e) {
Activator.getLogger().error("Error occurred while showing view " + viewId, e);
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, source, e.getMessage());
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, source, ExceptionMetadata.scrubException(e));
}
}
}
Expand All @@ -122,7 +123,7 @@ private static void showView(final String viewId, final String source) {
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, source, "none");
} catch (PartInitException e) {
Activator.getLogger().error("Error occurred while opening view " + viewId, e);
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, source, e.getMessage());
ToolkitTelemetryProvider.emitOpenModuleEventMetric(viewId, source, ExceptionMetadata.scrubException(e));
}
}
}
Expand Down
Loading