-
Notifications
You must be signed in to change notification settings - Fork 81
Remove eval error message on async frames #2073
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
Remove eval error message on async frames #2073
Conversation
…move-async-eval-error-message
@@ -13,16 +13,23 @@ import 'package:dwds/src/utilities/objects.dart' as chrome; | |||
import 'package:logging/logging.dart'; | |||
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; | |||
|
|||
class ErrorKind { | |||
const ErrorKind._(this._kind); | |||
class EvaluationErrorKind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would make sense as an enhanced enum
, with methods such as toDisplayName
/ fromDisplayName
so that we don't have to do the String matching (eg type.startsWith('${EvaluationErrorKind.compilation}')
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is not really possible to express what I wanted here in dart, which would be something like:
enum EvaluationErrorKind {
compilation = 'CompilationError',
reference = 'ReferenceError',
...
}
So i'll have to resort to the usual "define a bunch of const strings and add comments on function parameters" that we use everywhere:) I'll do that to match other use cases, but I don't like losing the type safety of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
I wonder if we could test this by providing a fake debugger (like we're providing a "real" debugger here) webdev/dwds/test/expression_evaluator_test.dart Lines 50 to 56 in 0a2804b
null for jsFrameForIndex .
I think ideally we need to add better support for unit testing and mocks though: #1643 |
Many other things will not work in the fake debugger (like location mapping etc) so I think we can do it as part of work for adding more unit tests and mocks. I'll think about it in the background as well, but for now I've found a way to test a real scenario - I figured out the way to hit the async code consistently, and it is matching flutter tools scenario (the code I keep hitting there when pausing is part of registering extensions machinery). |
Update: added a test in |
Closes: #2057