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

wrapping javascript errors to exceptions #3313

Closed
DartBot opened this issue May 30, 2012 · 18 comments
Closed

wrapping javascript errors to exceptions #3313

DartBot opened this issue May 30, 2012 · 18 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js

Comments

@DartBot
Copy link

DartBot commented May 30, 2012

This issue was originally filed by @bp74


I noticed a few revisions like r8103 where you try to wrap javascript errors to exceptions by looking at the message. This is a good idea but wont work on non english operating systems. If you run javascript on a german OS, the message is not "is undefined" but it is "ist undefiniert".

@peter-ahe-google
Copy link
Contributor

Thank you, that is a good point.


Added Area-Dart2JS, Triaged labels.

@DartBot
Copy link
Author

DartBot commented May 30, 2012

This comment was originally written by ngeoffray@google.com


cc @kasperl.

@kasperl
Copy link

kasperl commented May 31, 2012

We may have to wrap all JS exceptions we cannot understand in a general UnknownJsException or something like that. Not pretty.

@peter-ahe-google
Copy link
Contributor

We can also force a null pointer exception and try to deduce the error message.

This would be a last resort, I want to investigate the objects in IE and FF to see if there are other ways to identify the error.

@peter-ahe-google
Copy link
Contributor

Alternatively, we remove ClosureArgumentMismatchException, ObjectNotClosureException, and NullPointerException from the core library.

I have always believed that these classes all are implementation subclasses of NoSuchMethodException that the VM use to give better error messages.

The problem is that most of the co19 tests are checking for the subtle differences between these exceptions. I don't think the co19 tests would be worse if they cannot distinguish NullPointerException from NoSuchMethodException. I have always believed that what is important is that an exception is thrown, not the precise details, from a "conformance" perspective.

From a usability perspective, we should try to make as detailed exceptions as possible, but some browser simply doesn't provide enough information. However, I don't think a sane developer would care if the exception is NullPointerException or NoSuchMethodException, he cares that the error message is good.

@peter-ahe-google
Copy link
Contributor

I have provoked a "null pointer exception" in Firefox. I get an instance of TypeError that has only three properties:

["message", "fileName", "lineNumber"]

As far as I can tell, there is no additional information but matching on the "message" property or punning by having all these exceptions be a NoSuchMethodException.

@peter-ahe-google
Copy link
Contributor

Added this to the M1 milestone.

@peter-ahe-google
Copy link
Contributor

Issue #4703 has been merged into this issue.

@peter-ahe-google
Copy link
Contributor

On IE, it seems like we are looking for error code 438, facility 10.
See: http://msdn.microsoft.com/en-us/library/aa264511(v=vs.60)

This error code can be obtained using: JS('int', '#.number & 0xffff', ex).
See: http://msdn.microsoft.com/en-us/library/hc53e755(v=vs.94).aspx

Safari doesn't seem to localize JS exceptions, but I haven't tested it on iOS yet.

Firefox remains the big problem.


Set owner to @peter-ahe-google.
Added Accepted label.

@dgrove
Copy link
Contributor

dgrove commented Aug 27, 2012

this looks great for IE. We should apply these and revert the English-specific tests for IE asap (we can definitely get the CLs out Monday Pacific Time). Wish there was an FF solution...


cc @efortuna.
cc @rakudrama.

@kasperl
Copy link

kasperl commented Oct 8, 2012

Removed this from the M1 milestone.
Added this to the M2 milestone.

@kasperl
Copy link

kasperl commented Oct 17, 2012

Removed this from the M2 milestone.

@kasperl
Copy link

kasperl commented Oct 17, 2012

Added this to the M2 milestone.

@peter-ahe-google
Copy link
Contributor

Bumping priority: my second most starred M2 bug.


Removed Priority-Medium label.
Added Priority-High label.

@peter-ahe-google
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the M3 milestone.

@peter-ahe-google
Copy link
Contributor

Issue #7545 has been merged into this issue.

@peter-ahe-google
Copy link
Contributor

This is also causing problems in chrome.

@peter-ahe-google
Copy link
Contributor

Thinking more about issue #7545: I think it may be unrelated and a side-effect of our new interceptor implementation. So I don't think we have this issue in Chrome after all, and I'll reopen issue #7545.

@DartBot DartBot added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js labels Dec 21, 2012
@DartBot DartBot added this to the Later milestone Dec 21, 2012
copybara-service bot pushed a commit that referenced this issue Mar 29, 2022
Changes:
```
> git log --format="%C(auto) %h %s" 8f5ab7b..94ae66a
 https://dart.googlesource.com/pub.git/+/94ae66a6 Refine what a relative uri means in a git path (#3212)
 https://dart.googlesource.com/pub.git/+/cc4c1292 Only call Package.listFiles once per publish. (#3346)
 https://dart.googlesource.com/pub.git/+/f4484073 Fix test/global/activate/git_package_test test on windows (#3361)
 https://dart.googlesource.com/pub.git/+/610ce7f2 Refactor descriptors (#3305)
 https://dart.googlesource.com/pub.git/+/953b6097 Substitute pub.dartlang.org for of pub.dev (#3358)
 https://dart.googlesource.com/pub.git/+/7a6ea396 Add support for pubspec overrides file (#3215)
 https://dart.googlesource.com/pub.git/+/8abfed9d Global activate git path and ref (#3356)
 https://dart.googlesource.com/pub.git/+/d1c0e3f9 Revert "Add flag controlling creation of `.packages` file. (#2757)" (#3357)
 https://dart.googlesource.com/pub.git/+/274f5ad9 Fix signals test (#3359)
 https://dart.googlesource.com/pub.git/+/83437005 Avoid failing in gitignore validator (#3354)
 https://dart.googlesource.com/pub.git/+/3082796f dependency_services: Don't download archives on apply (#3352)
 https://dart.googlesource.com/pub.git/+/48d0ffaf dependency_services: Use ^ constraints for widened intervals when possible (#3349)
 https://dart.googlesource.com/pub.git/+/826e2086 Remove obsolete test (#3347)
 https://dart.googlesource.com/pub.git/+/35e5140b Bump analyzer from 2.8.0 to 3.3.1 (#3341)
 https://dart.googlesource.com/pub.git/+/52f2bdc2 Enable dependabot (#3340)
 https://dart.googlesource.com/pub.git/+/1e70c0c7 Remove `uploader` command (#3335)
 https://dart.googlesource.com/pub.git/+/3174a264 Warn if git version is not high enough for supporting all features (#3332)
 https://dart.googlesource.com/pub.git/+/3f7a3cb7 Don't analyze ignored directories in directory-validator (#3331)
 https://dart.googlesource.com/pub.git/+/e8f36614 Allow use of token for talking to pub.dev (#3330)
 https://dart.googlesource.com/pub.git/+/b93bf88f Upgrade `package:tar` to version `0.5.4`. (#3313)
 https://dart.googlesource.com/pub.git/+/fbc9732e Support for different versioning strategies in dependency_services (#3320)
 https://dart.googlesource.com/pub.git/+/93c7cfcd Update repository-spec-v2.md (#3311)
 https://dart.googlesource.com/pub.git/+/941191f7 dependency_services (#3304)
 https://dart.googlesource.com/pub.git/+/61175cb6 fix: relative to the current directory rules (#3297)
 https://dart.googlesource.com/pub.git/+/f27e90d3 Upgrade other versions conservatively with --major-versions (#3295)
 https://dart.googlesource.com/pub.git/+/a2461417 Add flag controlling creation of `.packages` file. (#2757)

```

Diff: https://dart.googlesource.com/pub.git/+/8f5ab7b1aba3b9f66b56246d77e167990339d317~..94ae66a660cc187cc46ceaf1ab96bdcf8d48a313/
Change-Id: I121fa281ad77991ef10938a3c228ce1d62e748db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238901
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
copybara-service bot pushed a commit that referenced this issue Mar 29, 2022
This reverts commit 6e00bb1.

Reason for revert: https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/flutter-engine-linux/16089/overview

Original change's description:
> Bump pub to 94ae66a660cc187cc46ceaf1ab96bdcf8d48a313
>
> Changes:
> ```
> > git log --format="%C(auto) %h %s" 8f5ab7b..94ae66a
>  https://dart.googlesource.com/pub.git/+/94ae66a6 Refine what a relative uri means in a git path (#3212)
>  https://dart.googlesource.com/pub.git/+/cc4c1292 Only call Package.listFiles once per publish. (#3346)
>  https://dart.googlesource.com/pub.git/+/f4484073 Fix test/global/activate/git_package_test test on windows (#3361)
>  https://dart.googlesource.com/pub.git/+/610ce7f2 Refactor descriptors (#3305)
>  https://dart.googlesource.com/pub.git/+/953b6097 Substitute pub.dartlang.org for of pub.dev (#3358)
>  https://dart.googlesource.com/pub.git/+/7a6ea396 Add support for pubspec overrides file (#3215)
>  https://dart.googlesource.com/pub.git/+/8abfed9d Global activate git path and ref (#3356)
>  https://dart.googlesource.com/pub.git/+/d1c0e3f9 Revert "Add flag controlling creation of `.packages` file. (#2757)" (#3357)
>  https://dart.googlesource.com/pub.git/+/274f5ad9 Fix signals test (#3359)
>  https://dart.googlesource.com/pub.git/+/83437005 Avoid failing in gitignore validator (#3354)
>  https://dart.googlesource.com/pub.git/+/3082796f dependency_services: Don't download archives on apply (#3352)
>  https://dart.googlesource.com/pub.git/+/48d0ffaf dependency_services: Use ^ constraints for widened intervals when possible (#3349)
>  https://dart.googlesource.com/pub.git/+/826e2086 Remove obsolete test (#3347)
>  https://dart.googlesource.com/pub.git/+/35e5140b Bump analyzer from 2.8.0 to 3.3.1 (#3341)
>  https://dart.googlesource.com/pub.git/+/52f2bdc2 Enable dependabot (#3340)
>  https://dart.googlesource.com/pub.git/+/1e70c0c7 Remove `uploader` command (#3335)
>  https://dart.googlesource.com/pub.git/+/3174a264 Warn if git version is not high enough for supporting all features (#3332)
>  https://dart.googlesource.com/pub.git/+/3f7a3cb7 Don't analyze ignored directories in directory-validator (#3331)
>  https://dart.googlesource.com/pub.git/+/e8f36614 Allow use of token for talking to pub.dev (#3330)
>  https://dart.googlesource.com/pub.git/+/b93bf88f Upgrade `package:tar` to version `0.5.4`. (#3313)
>  https://dart.googlesource.com/pub.git/+/fbc9732e Support for different versioning strategies in dependency_services (#3320)
>  https://dart.googlesource.com/pub.git/+/93c7cfcd Update repository-spec-v2.md (#3311)
>  https://dart.googlesource.com/pub.git/+/941191f7 dependency_services (#3304)
>  https://dart.googlesource.com/pub.git/+/61175cb6 fix: relative to the current directory rules (#3297)
>  https://dart.googlesource.com/pub.git/+/f27e90d3 Upgrade other versions conservatively with --major-versions (#3295)
>  https://dart.googlesource.com/pub.git/+/a2461417 Add flag controlling creation of `.packages` file. (#2757)
>
> ```
>
> Diff: https://dart.googlesource.com/pub.git/+/8f5ab7b1aba3b9f66b56246d77e167990339d317~..94ae66a660cc187cc46ceaf1ab96bdcf8d48a313/
> Change-Id: I121fa281ad77991ef10938a3c228ce1d62e748db
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238901
> Reviewed-by: Jonas Jensen <jonasfj@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

TBR=sigurdm@google.com,jonasfj@google.com

Change-Id: I2402e8647ad79a613d8be55a85a7f05f511a4081
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239301
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
copybara-service bot pushed a commit that referenced this issue Mar 30, 2022
Changes:
```
> git log --format="%C(auto) %h %s" 8f5ab7b..a3a102a
 https://dart.googlesource.com/pub.git/+/a3a102a5 Fix equality and hashcode for the sdk descriptors (#3367)
 https://dart.googlesource.com/pub.git/+/94ae66a6 Refine what a relative uri means in a git path (#3212)
 https://dart.googlesource.com/pub.git/+/cc4c1292 Only call Package.listFiles once per publish. (#3346)
 https://dart.googlesource.com/pub.git/+/f4484073 Fix test/global/activate/git_package_test test on windows (#3361)
 https://dart.googlesource.com/pub.git/+/610ce7f2 Refactor descriptors (#3305)
 https://dart.googlesource.com/pub.git/+/953b6097 Substitute pub.dartlang.org for of pub.dev (#3358)
 https://dart.googlesource.com/pub.git/+/7a6ea396 Add support for pubspec overrides file (#3215)
 https://dart.googlesource.com/pub.git/+/8abfed9d Global activate git path and ref (#3356)
 https://dart.googlesource.com/pub.git/+/d1c0e3f9 Revert "Add flag controlling creation of `.packages` file. (#2757)" (#3357)
 https://dart.googlesource.com/pub.git/+/274f5ad9 Fix signals test (#3359)
 https://dart.googlesource.com/pub.git/+/83437005 Avoid failing in gitignore validator (#3354)
 https://dart.googlesource.com/pub.git/+/3082796f dependency_services: Don't download archives on apply (#3352)
 https://dart.googlesource.com/pub.git/+/48d0ffaf dependency_services: Use ^ constraints for widened intervals when possible (#3349)
 https://dart.googlesource.com/pub.git/+/826e2086 Remove obsolete test (#3347)
 https://dart.googlesource.com/pub.git/+/35e5140b Bump analyzer from 2.8.0 to 3.3.1 (#3341)
 https://dart.googlesource.com/pub.git/+/52f2bdc2 Enable dependabot (#3340)
 https://dart.googlesource.com/pub.git/+/1e70c0c7 Remove `uploader` command (#3335)
 https://dart.googlesource.com/pub.git/+/3174a264 Warn if git version is not high enough for supporting all features (#3332)
 https://dart.googlesource.com/pub.git/+/3f7a3cb7 Don't analyze ignored directories in directory-validator (#3331)
 https://dart.googlesource.com/pub.git/+/e8f36614 Allow use of token for talking to pub.dev (#3330)
 https://dart.googlesource.com/pub.git/+/b93bf88f Upgrade `package:tar` to version `0.5.4`. (#3313)
 https://dart.googlesource.com/pub.git/+/fbc9732e Support for different versioning strategies in dependency_services (#3320)
 https://dart.googlesource.com/pub.git/+/93c7cfcd Update repository-spec-v2.md (#3311)
 https://dart.googlesource.com/pub.git/+/941191f7 dependency_services (#3304)
 https://dart.googlesource.com/pub.git/+/61175cb6 fix: relative to the current directory rules (#3297)
 https://dart.googlesource.com/pub.git/+/f27e90d3 Upgrade other versions conservatively with --major-versions (#3295)
 https://dart.googlesource.com/pub.git/+/a2461417 Add flag controlling creation of `.packages` file. (#2757)

```

Diff: https://dart.googlesource.com/pub.git/+/8f5ab7b1aba3b9f66b56246d77e167990339d317~..a3a102a549388a6dbfecc9252fabb618f9a2f5f7/
Change-Id: I8d0ea375039ea450d397871d9fac35d590ea8869
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239315
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
copybara-service bot pushed a commit that referenced this issue Feb 8, 2023
dartdoc:
494a6bed  2023-02-02  Sam Rawlins  Bump markdown dep to a pre-release of 7.0.0 (#3321)
ad6f1612  2023-02-02  Devon Carew  introduce an environmentProvider abstraction (#3324)
d0b73000  2023-02-02  Sam Rawlins  Prepare testing code for some upcoming Warnings (#3322)
936a7888  2023-02-01  Sam Rawlins  Add text about front-end manual testing (#3286)
cbee812d  2023-02-01  Sam Rawlins  Avoid renaming generator params (#3316)
bcaa0349  2023-02-01  Sam Rawlins  Privatize Library.sdkLib and move getClassByName (#3317)
af32def5  2023-01-31  dependabot[bot]  Bump github/codeql-action from 2.1.39 to 2.2.1 (#3313)
528e97da  2023-01-31  dependabot[bot]  Bump actions/cache from 3.2.3 to 3.2.4 (#3312)
54020672  2023-02-01  Parker Lougheed  Begin changelog for next release after 6.1.5 (#3315)

markdown:
f51c24c  2023-02-01  Zhiguang Chen  Prepend a line ending if the p tag is removed and there is an element before it in a *tight* list (#513)
dd3e3a1  2023-01-31  dependabot[bot]  Bump dart-lang/setup-dart from 1.3 to 1.4 (#510)
5f25fc9  2023-01-31  dependabot[bot]  Bump actions/checkout from 3.2.0 to 3.3.0 (#511)
54266b2  2023-01-31  Kevin Moore  Prepare to release v7.0.0 (#509)
d6ceff9  2023-01-31  Zhiguang Chen  Add line endings before HTML blocks (#508)
ccd3c8b  2023-01-29  Zhiguang Chen  Rewrite link reference definitions (#506)
e8f84dc  2023-01-24  Kevin Moore  Update GFM to 0.29.0.gfm.7 (#507)
93f67b0  2023-01-20  Zhiguang Chen  Add an `enableTagfilter` option to `HtmlRenderer` to eanble GFM `tagfilter` extension (#447)
d110770  2023-01-13  Zhiguang Chen  Rewrite SetextHeaderSyntax (#500)
c1b9bc6  2023-01-09  Sam Rawlins  Migrate from no-implicit-casts to strict-casts (#504)
3e78c08  2023-01-01  dependabot[bot]  Bump actions/checkout from 3.0.2 to 3.2.0 (#501)
417747f  2022-12-15  Zhiguang Chen  Refactor list syntax (#499)
30ec05f  2022-11-29  Zhiguang Chen  Do not escape single quote(apostrophe) inside code (#498)
c3d1136  2022-11-29  Zhiguang Chen  introduce a Line class (#494)
Change-Id: I9d971b927b72500ab84cce461a60fe1a86818e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281543
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants