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

Add definitions for a module erroring #839

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jpinkney-aws
Copy link
Contributor

@jpinkney-aws jpinkney-aws commented Aug 30, 2024

Problem

We have no way to track errors that occur within a module that occur outside of a regular telemetry execution scope. E.g. listening on a window for errors via window.addEventListener('error')

Solution

  • toolkit_errorModule which is called when an unexpected error occurs outside of regular telemetry messages

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jpinkney-aws jpinkney-aws requested a review from a team as a code owner August 30, 2024 10:55
@jpinkney-aws jpinkney-aws force-pushed the jpinkney-aws/webview-load branch from 7b274d1 to dc421bc Compare August 30, 2024 10:59
@jpinkney-aws jpinkney-aws force-pushed the jpinkney-aws/webview-load branch from dc421bc to f139ff6 Compare August 30, 2024 17:53
@awschristou
Copy link
Contributor

awschristou commented Aug 30, 2024

I suggest building on toolkit_openModule from #835 and making these

  • toolkit_loadModule
  • toolkit_errorModule

These become more generalized than "web views"

(suggestion is non-blocking)

@@ -7138,6 +7138,26 @@
"type": "result"
}
]
},
{
"name": "webview_error",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Every event can store result, reason, reasonDesc. Errors should not be modeled as separate events, they should be modeled as existing events with result=Failed + reason.

E.g. in this case webview_load could be such an event. If failure can occur after load, and we want a generic "webview interaction" event, then let's consider that instead. E.g. webview_click, webview_submit, etc.

Copy link
Contributor Author

@jpinkney-aws jpinkney-aws Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webview_error in this case is an generic error that can get thrown inside of mynah ui. Not sure if you can tie it directly to a chatMessage or anything since it can appear whenever: https://github.com/aws/aws-toolkit-vscode/blob/master/packages/core/src/amazonq/webview/ui/main.ts#L26

In the case of webview_load, thats how we do it. If the webview fails to load we set the reason description and result failed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinmk3
Copy link
Contributor

justinmk3 commented Aug 31, 2024

[toolkit_loadModule, toolkit_errorModule are] more generalized than "web views"

+1

Though toolkit_errorModule is questionable for the same reason as webview_error.

Instead of dedicated "error" events, model actual events which can fail (result=Failed).

@jpinkney-aws
Copy link
Contributor Author

Does Called when an unexpected error occurs within a module outside of regular metrics tracking make it more clear where toolkit_errorModule can be used?

In VSCode it's goal is to track: window.addEventListener('error') messages that can occur at any time for any reason

@jpinkney-aws jpinkney-aws changed the title Add definitions for a webview being loaded/erroring Add definitions for a module erroring Sep 4, 2024
@justinmk3
Copy link
Contributor

Does Called when an unexpected error occurs within a module outside of regular metrics tracking make it more clear where toolkit_errorModule can be used?

In VSCode it's goal is to track: window.addEventListener('error') messages that can occur at any time for any reason

That could make sense. Mentioning "Example: window.addEventListener('error')" in the description could help too.

OTOH, if we want a generic thing that captures unknown webview events, can we not name it webview_event ? That leaves the door open for capturing other events (both successes and failures). This is similar to ui_click and vscode_executeCommand which are rather generic but capture both success and failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants