Chromium Code Reviews| Index: corelib/src/exceptions.dart |
| =================================================================== |
| --- corelib/src/exceptions.dart (revision 6423) |
| +++ corelib/src/exceptions.dart (working copy) |
| @@ -121,8 +121,27 @@ |
| class NullPointerException implements Exception { |
| - const NullPointerException(); |
| - String toString() => "NullPointerException"; |
| + const NullPointerException([this.functionName, |
| + this.arguments = const[]]); |
|
sra1
2012/04/11 20:43:12
NullPointerException is called from hand written J
|
| + String toString() { |
| + StringBuffer sb = new StringBuffer(); |
| + for (var arg in arguments) { |
| + if (!sb.isEmpty()) sb.add(", "); |
| + sb.add(arg); |
| + } |
| + if (functionName == null) { |
|
sra1
2012/04/11 20:43:12
Do this test first. No need to allocate a StringB
|
| + return exceptionName; |
| + } else { |
| + return "$exceptionName : method: '$functionName'\n" |
| + "Receiver: null\n" |
| + "Arguments: [$sb]"; |
| + } |
| + } |
| + |
| + String get exceptionName() => "NullPointerException"; |
| + |
| + final String functionName; |
| + final List arguments; |
| } |