Skip to content
New issue

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

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

Already on GitHub? # to your account

Unclear error message for function getting wrong arguments #2156

Closed
DartBot opened this issue Mar 14, 2012 · 10 comments
Closed

Unclear error message for function getting wrong arguments #2156

DartBot opened this issue Mar 14, 2012 · 10 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant

Comments

@DartBot
Copy link

DartBot commented Mar 14, 2012

This issue was originally filed by lod...@google.com


Hello,

I tried out code like this, where "view.on.click" takes a function responding to mouse click events:

view.on.click = function() {
  print('clicked');
};

The above is wrong, it has to be, for example:

view.on.click = function(var event) {
  print('clicked');
};

Dartium gives the following error message:

Exception: Closure argument mismatch

It would be nice if it would say something more helpful, like "Wrong function signature, one argument of type ..... required".

@DartBot
Copy link
Author

DartBot commented Mar 30, 2012

This comment was originally written by antonm@google.com


Lode, have you tried to run this code in checked mode (http://www.dartlang.org/articles/optional-types/) ?


Removed Area-Dartium label.
Added Area-VM, NeedsInfo labels.

@DartBot
Copy link
Author

DartBot commented Apr 3, 2012

This comment was originally written by lod...@google.com


The error is better in checked mode:

 type '() => Dynamic' is not a subtype of type '(Event) => void' of 'handler'.

So I guess we have to learn to recognize different error messages in checked and non checked mode? :)

@sethladd
Copy link
Contributor

Added Usability, Triaged labels.

@iposva-google
Copy link
Contributor

Added this to the M2 milestone.
Removed Usability label.

@iposva-google
Copy link
Contributor

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

@iposva-google
Copy link
Contributor

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

@larsbak
Copy link

larsbak commented May 28, 2013

Removed this from the M4 milestone.
Added this to the M5 milestone.

@iposva-google
Copy link
Contributor

Removed Priority-Medium label.
Added Priority-Unassigned label.

@iposva-google
Copy link
Contributor

Removed this from the M5 milestone.

@DartBot
Copy link
Author

DartBot commented Sep 19, 2013

This comment was originally written by @mhausner


I think this is no longer accurate. In a similar situation calling a closure with wrong number of arguments) we now get this info in production mode (i.e. not checked mode):

NoSuchMethodError: incorrect number of arguments passed to method named 'main.<anonymous closure>'
Receiver: Closure: () => dynamic
Tried calling: main.<anonymous closure>("hello")
Found: main.<anonymous closure>()


Added AssumedStale label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant labels Sep 19, 2013
copybara-service bot pushed a commit that referenced this issue Jan 8, 2024
matcher (https://github.com/dart-lang/matcher/compare/fcbd361..d9cf4f6):
  d9cf4f6  2024-01-01  dependabot[bot]  Bump actions/stale from 8.0.0 to 9.0.0 (#240)
  7ea9047  2023-12-13  Kevin Moore  Update test_api dependency, bump & fix lints, prepare release (#237)
  050fdda  2023-12-13  Kevin Moore  blast_repo fixes (#238)

mockito (https://github.com/dart-lang/mockito/compare/57a7c82..e15e000):
  e15e000  2023-12-14  Sam Rawlins  Bump mockito to 5.4.4
  a2a6566  2023-12-14  Copybara-Service  Merge pull request #726 from provokateurin:chore/deps/test_api-0.7
  bda332c  2023-12-14  jld3103  chore(deps): Allow test_api 0.7
  9bd6fb0  2023-12-12  Paul Berry  Remove mockito pre-null-safety tests.

test (https://github.com/dart-lang/test/compare/43ff5bf..846d73e):
  846d73ee  2024-01-01  dependabot[bot]  Bump actions/upload-artifact from 3.1.3 to 4.0.0 (#2165)
  0ab56790  2024-01-01  dependabot[bot]  Bump actions/stale from 8.0.0 to 9.0.0 (#2167)
  3b960c3e  2024-01-01  dependabot[bot]  Bump github/codeql-action from 2.22.8 to 3.22.12 (#2166)
  30543cae  2023-12-19  Nate Bosch  Add more logging around iframe startup (#2160)
  e56a5e22  2023-12-13  Jacob MacDonald  small cleanup in catch (#2159)
  15b39372  2023-12-13  Jacob MacDonald  handle missing package config files (#2158)
  9667cca8  2023-12-13  Jacob MacDonald  release test_api 7.0.0, test_core 6.0.0, and test 1.25.0 (#2156)
  b3fb1486  2023-12-13  Nate Bosch  Remove support for Internet Explorer (#2114)
  48a2bc3d  2023-12-13  Derek Xu  Update the package:vm_service constraint to allow version 14.x (#2157)

Change-Id: I386444652c47cd14a61665599d86dc3a7669a2fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345341
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This issue was closed.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

4 participants