Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: corelib/src/exceptions.dart

Issue 9307074: If programmer mistakes the number of arguments, VM throws noSuchMethod. Extend reporting to repor... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Exceptions are thrown either by the VM or from Dart code. 5 // Exceptions are thrown either by the VM or from Dart code.
6 6
7 /** 7 /**
8 * Interface implemented by all core library exceptions. 8 * Interface implemented by all core library exceptions.
9 */ 9 */
10 interface Exception default ExceptionImplementation { 10 interface Exception default ExceptionImplementation {
(...skipping 19 matching lines...) Expand all
30 String toString() => "Attempt to modify an immutable object"; 30 String toString() => "Attempt to modify an immutable object";
31 } 31 }
32 32
33 33
34 /** 34 /**
35 * Exception thrown because of non-existing receiver's method. 35 * Exception thrown because of non-existing receiver's method.
36 */ 36 */
37 class NoSuchMethodException implements Exception { 37 class NoSuchMethodException implements Exception {
38 const NoSuchMethodException(Object this._receiver, 38 const NoSuchMethodException(Object this._receiver,
39 String this._functionName, 39 String this._functionName,
40 List this._arguments); 40 List this._arguments,
41 [String this._extraMessage = ""]);
41 42
42 String toString() { 43 String toString() {
43 StringBuffer sb = new StringBuffer(); 44 StringBuffer sb = new StringBuffer();
44 for (int i = 0; i < _arguments.length; i++) { 45 for (int i = 0; i < _arguments.length; i++) {
45 if (i > 0) { 46 if (i > 0) {
46 sb.add(", "); 47 sb.add(", ");
47 } 48 }
48 sb.add(_arguments[i]); 49 sb.add(_arguments[i]);
49 } 50 }
50 sb.add("]"); 51 sb.add("]");
52 var x = _extraMessage;
51 return "NoSuchMethodException - receiver: '$_receiver' " + 53 return "NoSuchMethodException - receiver: '$_receiver' " +
52 "function name: '$_functionName' arguments: [$sb]"; 54 "function name: '$_functionName' arguments: [$sb]$x";
53 } 55 }
54 56
55 final Object _receiver; 57 final Object _receiver;
56 final String _functionName; 58 final String _functionName;
57 final List _arguments; 59 final List _arguments;
60 final String _extraMessage;
58 } 61 }
59 62
60 63
61 class ClosureArgumentMismatchException implements Exception { 64 class ClosureArgumentMismatchException implements Exception {
62 const ClosureArgumentMismatchException(); 65 const ClosureArgumentMismatchException();
63 String toString() => "Closure argument mismatch"; 66 String toString() => "Closure argument mismatch";
64 } 67 }
65 68
66 69
67 class ObjectNotClosureException implements Exception { 70 class ObjectNotClosureException implements Exception {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 String toString() => "IllegalJSRegExpException: '$_pattern' '$_errmsg'"; 141 String toString() => "IllegalJSRegExpException: '$_pattern' '$_errmsg'";
139 final String _pattern; 142 final String _pattern;
140 final String _errmsg; 143 final String _errmsg;
141 } 144 }
142 145
143 146
144 class IntegerDivisionByZeroException implements Exception { 147 class IntegerDivisionByZeroException implements Exception {
145 const IntegerDivisionByZeroException(); 148 const IntegerDivisionByZeroException();
146 String toString() => "IntegerDivisionByZeroException"; 149 String toString() => "IntegerDivisionByZeroException";
147 } 150 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698