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

Side by Side Diff: runtime/vm/exceptions.h

Issue 1778133002: Enumerate URIs of all types in type errors in order to help the user diagnose (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 4 years, 9 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
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/exceptions.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #ifndef VM_EXCEPTIONS_H_ 5 #ifndef VM_EXCEPTIONS_H_
6 #define VM_EXCEPTIONS_H_ 6 #define VM_EXCEPTIONS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/token_position.h" 9 #include "vm/token_position.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 // Forward declarations. 13 // Forward declarations.
14 class AbstractType;
14 class Array; 15 class Array;
15 class Class;
16 class DartFrameIterator; 16 class DartFrameIterator;
17 class Error; 17 class Error;
18 class Instance; 18 class Instance;
19 class Integer; 19 class Integer;
20 class Object;
21 class RawInstance; 20 class RawInstance;
22 class RawObject; 21 class RawObject;
23 class RawScript; 22 class RawScript;
24 class RawStacktrace; 23 class RawStacktrace;
25 class RawString;
26 class Script;
27 class StackFrame;
28 class Stacktrace;
29 class String; 24 class String;
30 class Thread; 25 class Thread;
31 26
32 class Exceptions : AllStatic { 27 class Exceptions : AllStatic {
33 public: 28 public:
34 static const char* kCastErrorDstName;
35
36 static void Throw(Thread* thread, const Instance& exception); 29 static void Throw(Thread* thread, const Instance& exception);
37 static void ReThrow(Thread* thread, 30 static void ReThrow(Thread* thread,
38 const Instance& exception, 31 const Instance& exception,
39 const Instance& stacktrace); 32 const Instance& stacktrace);
40 static void PropagateError(const Error& error); 33 static void PropagateError(const Error& error);
41 34
42 // Helpers to create and throw errors. 35 // Helpers to create and throw errors.
43 static RawStacktrace* CurrentStacktrace(); 36 static RawStacktrace* CurrentStacktrace();
44 static RawScript* GetCallerScript(DartFrameIterator* iterator); 37 static RawScript* GetCallerScript(DartFrameIterator* iterator);
45 static RawInstance* NewInstance(const char* class_name); 38 static RawInstance* NewInstance(const char* class_name);
46 static void CreateAndThrowTypeError(TokenPosition location, 39 static void CreateAndThrowTypeError(TokenPosition location,
47 const String& src_type_name, 40 const AbstractType& src_type,
48 const String& dst_type_name, 41 const AbstractType& dst_type,
49 const String& dst_name, 42 const String& dst_name,
50 const String& error_msg); 43 const String& bound_error_msg);
51 44
52 enum ExceptionType { 45 enum ExceptionType {
53 kNone, 46 kNone,
54 kRange, 47 kRange,
55 kArgument, 48 kArgument,
56 kArgumentValue, 49 kArgumentValue,
57 kNoSuchMethod, 50 kNoSuchMethod,
58 kFormat, 51 kFormat,
59 kUnsupported, 52 kUnsupported,
60 kStackOverflow, 53 kStackOverflow,
(...skipping 23 matching lines...) Expand all
84 // otherwise returns a RawError. 77 // otherwise returns a RawError.
85 static RawObject* Create(ExceptionType type, const Array& arguments); 78 static RawObject* Create(ExceptionType type, const Array& arguments);
86 79
87 private: 80 private:
88 DISALLOW_COPY_AND_ASSIGN(Exceptions); 81 DISALLOW_COPY_AND_ASSIGN(Exceptions);
89 }; 82 };
90 83
91 } // namespace dart 84 } // namespace dart
92 85
93 #endif // VM_EXCEPTIONS_H_ 86 #endif // VM_EXCEPTIONS_H_
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/exceptions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698