Flutter Engine
The Flutter Engine
Public Types | Static Public Member Functions | List of all members
dart::Exceptions Class Reference

#include <exceptions.h>

Inheritance diagram for dart::Exceptions:
dart::AllStatic

Public Types

enum  ExceptionType {
  kNone , kRange , kRangeMsg , kArgument ,
  kArgumentValue , kState , kIntegerDivisionByZeroException , kNoSuchMethod ,
  kFormat , kUnsupported , kStackOverflow , kOutOfMemory ,
  kIsolateSpawn , kAssertion , kType , kAbstractClassInstantiation ,
  kCyclicInitializationError , kCompileTimeError , kLateFieldAssignedDuringInitialization , kLateFieldNotInitialized
}
 

Static Public Member Functions

static DART_NORETURN void Throw (Thread *thread, const Instance &exception)
 
static DART_NORETURN void ReThrow (Thread *thread, const Instance &exception, const Instance &stacktrace, bool bypass_debugger=false)
 
static DART_NORETURN void ThrowWithStackTrace (Thread *thread, const Instance &exception, const Instance &stacktrace)
 
static DART_NORETURN void PropagateError (const Error &error)
 
static DART_NORETURN void PropagateToEntry (const Error &error)
 
static StackTracePtr CurrentStackTrace ()
 
static ScriptPtr GetCallerScript (DartFrameIterator *iterator)
 
static InstancePtr NewInstance (const char *class_name)
 
static void CreateAndThrowTypeError (TokenPosition location, const AbstractType &src_type, const AbstractType &dst_type, const String &dst_name)
 
static DART_NORETURN void ThrowByType (ExceptionType type, const Array &arguments)
 
static DART_NORETURN void ThrowOOM ()
 
static DART_NORETURN void ThrowStackOverflow ()
 
static DART_NORETURN void ThrowArgumentError (const Instance &arg)
 
static DART_NORETURN void ThrowStateError (const Instance &arg)
 
static DART_NORETURN void ThrowRangeError (const char *argument_name, const Integer &argument_value, intptr_t expected_from, intptr_t expected_to)
 
static DART_NORETURN void ThrowUnsupportedError (const char *msg)
 
static DART_NORETURN void ThrowCompileTimeError (const LanguageError &error)
 
static DART_NORETURN void ThrowLateFieldAssignedDuringInitialization (const String &name)
 
static DART_NORETURN void ThrowLateFieldNotInitialized (const String &name)
 
static ObjectPtr Create (ExceptionType type, const Array &arguments)
 
static UnhandledExceptionPtr CreateUnhandledException (Zone *zone, ExceptionType type, const char *msg)
 
static DART_NORETURN void JumpToFrame (Thread *thread, uword program_counter, uword stack_pointer, uword frame_pointer, bool clear_deopt_at_target)
 

Detailed Description

Definition at line 29 of file exceptions.h.

Member Enumeration Documentation

◆ ExceptionType

Enumerator
kNone 
kRange 
kRangeMsg 
kArgument 
kArgumentValue 
kState 
kIntegerDivisionByZeroException 
kNoSuchMethod 
kFormat 
kUnsupported 
kStackOverflow 
kOutOfMemory 
kIsolateSpawn 
kAssertion 
kType 
kAbstractClassInstantiation 
kCyclicInitializationError 
kCompileTimeError 
kLateFieldAssignedDuringInitialization 
kLateFieldNotInitialized 

Definition at line 53 of file exceptions.h.

53 {
54 kNone,
55 kRange,
59 kState,
62 kFormat,
68 kType,
74 };
@ kCyclicInitializationError
Definition: exceptions.h:70
@ kAbstractClassInstantiation
Definition: exceptions.h:69
@ kLateFieldNotInitialized
Definition: exceptions.h:73
@ kLateFieldAssignedDuringInitialization
Definition: exceptions.h:72
@ kIntegerDivisionByZeroException
Definition: exceptions.h:60

Member Function Documentation

◆ Create()

ObjectPtr dart::Exceptions::Create ( ExceptionType  type,
const Array arguments 
)
static

Definition at line 1132 of file exceptions.cc.

1132 {
1133 Library& library = Library::Handle();
1134 const String* class_name = nullptr;
1135 const String* constructor_name = &Symbols::Dot();
1136 switch (type) {
1137 case kNone:
1138 case kStackOverflow:
1139 case kOutOfMemory:
1140 UNREACHABLE();
1141 break;
1142 case kRange:
1143 library = Library::CoreLibrary();
1144 class_name = &Symbols::RangeError();
1145 constructor_name = &Symbols::DotRange();
1146 break;
1147 case kRangeMsg:
1148 library = Library::CoreLibrary();
1149 class_name = &Symbols::RangeError();
1150 constructor_name = &Symbols::Dot();
1151 break;
1152 case kArgument:
1153 library = Library::CoreLibrary();
1154 class_name = &Symbols::ArgumentError();
1155 break;
1156 case kArgumentValue:
1157 library = Library::CoreLibrary();
1158 class_name = &Symbols::ArgumentError();
1159 constructor_name = &Symbols::DotValue();
1160 break;
1161 case kState:
1162 library = Library::CoreLibrary();
1163 class_name = &Symbols::StateError();
1164 break;
1166 library = Library::CoreLibrary();
1167 class_name = &Symbols::IntegerDivisionByZeroException();
1168 break;
1169 case kNoSuchMethod:
1170 library = Library::CoreLibrary();
1171 class_name = &Symbols::NoSuchMethodError();
1172 constructor_name = &Symbols::DotWithType();
1173 break;
1174 case kFormat:
1175 library = Library::CoreLibrary();
1176 class_name = &Symbols::FormatException();
1177 break;
1178 case kUnsupported:
1179 library = Library::CoreLibrary();
1180 class_name = &Symbols::UnsupportedError();
1181 break;
1182 case kIsolateSpawn:
1183 library = Library::IsolateLibrary();
1184 class_name = &Symbols::IsolateSpawnException();
1185 break;
1186 case kAssertion:
1187 library = Library::CoreLibrary();
1188 class_name = &Symbols::AssertionError();
1189 constructor_name = &Symbols::DotCreate();
1190 break;
1191 case kType:
1192 library = Library::CoreLibrary();
1193 class_name = &Symbols::TypeError();
1194 constructor_name = &Symbols::DotCreate();
1195 break;
1197#if defined(DART_PRECOMPILED_RUNTIME)
1198 UNREACHABLE();
1199#else
1200 library = Library::MirrorsLibrary();
1201 class_name = &Symbols::AbstractClassInstantiationError();
1202 constructor_name = &Symbols::DotCreate();
1203 break;
1204#endif
1206 library = Library::CoreLibrary();
1207 class_name = &Symbols::_CyclicInitializationError();
1208 break;
1209 case kCompileTimeError:
1210 library = Library::CoreLibrary();
1211 class_name = &Symbols::_CompileTimeError();
1212 break;
1214 library = Library::InternalLibrary();
1215 class_name = &Symbols::LateError();
1216 constructor_name = &Symbols::DotFieldADI();
1217 break;
1219 library = Library::InternalLibrary();
1220 class_name = &Symbols::LateError();
1221 constructor_name = &Symbols::DotFieldNI();
1222 break;
1223 }
1224
1226 *constructor_name, arguments);
1227}
#define UNREACHABLE()
Definition: assert.h:248
GLenum type
static ObjectPtr InstanceCreate(const Library &library, const String &exception_name, const String &constructor_name, const Array &arguments)
Definition: dart_entry.cc:583
static LibraryPtr CoreLibrary()
Definition: object.cc:14787
static LibraryPtr MirrorsLibrary()
Definition: object.cc:14816
static LibraryPtr IsolateLibrary()
Definition: object.cc:14807
static LibraryPtr InternalLibrary()
Definition: object.cc:14803
static Object & Handle()
Definition: object.h:407
static const String & Dot()
Definition: symbols.h:613
const char *const class_name

◆ CreateAndThrowTypeError()

void dart::Exceptions::CreateAndThrowTypeError ( TokenPosition  location,
const AbstractType src_type,
const AbstractType dst_type,
const String dst_name 
)
static

Definition at line 896 of file exceptions.cc.

899 {
900 ASSERT(!dst_name.IsNull()); // Pass Symbols::Empty() instead.
901 Thread* thread = Thread::Current();
902 Zone* zone = thread->zone();
903 const Array& args = Array::Handle(zone, Array::New(4));
904
905 ExceptionType exception_type = kType;
906
907 DartFrameIterator iterator(thread,
909 const Script& script = Script::Handle(zone, GetCallerScript(&iterator));
910 const String& url = String::Handle(
911 zone, script.IsNull() ? Symbols::OptimizedOut().ptr() : script.url());
912 intptr_t line = -1;
913 intptr_t column = -1;
914 if (!script.IsNull()) {
915 script.GetTokenLocation(location, &line, &column);
916 }
917 // Initialize '_url', '_line', and '_column' arguments.
918 args.SetAt(0, url);
919 args.SetAt(1, Smi::Handle(zone, Smi::New(line)));
920 args.SetAt(2, Smi::Handle(zone, Smi::New(column)));
921
922 // Construct '_errorMsg'.
923 const GrowableObjectArray& pieces =
925
926 if (!dst_type.IsNull()) {
927 // Describe the type error.
928 if (!src_type.IsNull()) {
929 pieces.Add(Symbols::TypeQuote());
930 pieces.Add(String::Handle(zone, src_type.UserVisibleName()));
931 pieces.Add(Symbols::QuoteIsNotASubtypeOf());
932 }
933 pieces.Add(Symbols::TypeQuote());
934 pieces.Add(String::Handle(zone, dst_type.UserVisibleName()));
935 pieces.Add(Symbols::SingleQuote());
936 if (dst_name.Length() > 0) {
937 if (dst_name.ptr() == Symbols::InTypeCast().ptr()) {
938 pieces.Add(dst_name);
939 } else {
940 pieces.Add(Symbols::SpaceOfSpace());
941 pieces.Add(Symbols::SingleQuote());
942 pieces.Add(dst_name);
943 pieces.Add(Symbols::SingleQuote());
944 }
945 }
946 // Print ambiguous URIs of src and dst types.
947 URIs uris(zone, 12);
948 if (!src_type.IsNull()) {
949 src_type.EnumerateURIs(&uris);
950 }
951 if (!dst_type.IsDynamicType() && !dst_type.IsVoidType() &&
952 !dst_type.IsNeverType()) {
953 dst_type.EnumerateURIs(&uris);
954 }
955 const String& formatted_uris =
957 if (formatted_uris.Length() > 0) {
958 pieces.Add(Symbols::SpaceWhereNewLine());
959 pieces.Add(formatted_uris);
960 }
961 }
962 const Array& arr = Array::Handle(zone, Array::MakeFixedLength(pieces));
963 const String& error_msg = String::Handle(zone, String::ConcatAll(arr));
964 args.SetAt(3, error_msg);
965
966 // Type errors in the core library may be difficult to diagnose.
967 // Print type error information before throwing the error when debugging.
968 if (FLAG_print_stacktrace_at_throw) {
969 THR_Print("'%s': Failed type check: line %" Pd " pos %" Pd ": ",
970 String::Handle(zone, script.url()).ToCString(), line, column);
971 THR_Print("%s\n", error_msg.ToCString());
972 }
973
974 // Throw TypeError instance.
975 Exceptions::ThrowByType(exception_type, args);
976 UNREACHABLE();
977}
static StringPtr PrintURIs(URIs *uris)
Definition: object.cc:21283
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
static ArrayPtr MakeFixedLength(const GrowableObjectArray &growable_array, bool unique=false)
Definition: object.cc:24935
static DART_NORETURN void ThrowByType(ExceptionType type, const Array &arguments)
Definition: exceptions.cc:1052
static ScriptPtr GetCallerScript(DartFrameIterator *iterator)
Definition: exceptions.cc:867
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
Definition: object.h:11144
virtual const char * ToCString() const
Definition: object.h:366
static SmiPtr New(intptr_t value)
Definition: object.h:10006
static StringPtr ConcatAll(const Array &strings, Heap::Space space=Heap::kNew)
Definition: object.cc:24048
static const String & SingleQuote()
Definition: symbols.h:657
static Thread * Current()
Definition: thread.h:362
#define THR_Print(format,...)
Definition: log.h:20
#define ASSERT(E)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
ZoneGrowableHandlePtrArray< const String > URIs
Definition: object.h:1110
#define Pd
Definition: globals.h:408

◆ CreateUnhandledException()

UnhandledExceptionPtr dart::Exceptions::CreateUnhandledException ( Zone zone,
ExceptionType  type,
const char *  msg 
)
static

Definition at line 1229 of file exceptions.cc.

1231 {
1232 const String& error_str = String::Handle(zone, String::New(msg));
1233 const Array& args = Array::Handle(zone, Array::New(1));
1234 args.SetAt(0, error_str);
1235
1237 const StackTrace& stacktrace = StackTrace::Handle(zone);
1238 return UnhandledException::New(Instance::Cast(result), stacktrace);
1239}
static ObjectPtr Create(ExceptionType type, const Array &arguments)
Definition: exceptions.cc:1132
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
static UnhandledExceptionPtr New(const Instance &exception, const Instance &stacktrace, Heap::Space space=Heap::kNew)
Definition: object.cc:19939
GAsyncResult * result

◆ CurrentStackTrace()

StackTracePtr dart::Exceptions::CurrentStackTrace ( )
static

Definition at line 726 of file exceptions.cc.

726 {
728}
StackTracePtr GetStackTraceForException()
Definition: stacktrace.cc:56

◆ GetCallerScript()

ScriptPtr dart::Exceptions::GetCallerScript ( DartFrameIterator iterator)
static

Definition at line 867 of file exceptions.cc.

867 {
868 StackFrame* caller_frame = iterator->NextFrame();
869 ASSERT(caller_frame != nullptr && caller_frame->IsDartFrame());
870 const Function& caller = Function::Handle(caller_frame->LookupDartFunction());
871#if defined(DART_PRECOMPILED_RUNTIME)
872 if (caller.IsNull()) return Script::null();
873#else
874 ASSERT(!caller.IsNull());
875#endif
876 return caller.script();
877}
static ObjectPtr null()
Definition: object.h:433

◆ JumpToFrame()

NO_SANITIZE_SAFE_STACK void dart::Exceptions::JumpToFrame ( Thread thread,
uword  program_counter,
uword  stack_pointer,
uword  frame_pointer,
bool  clear_deopt_at_target 
)
static

Definition at line 631 of file exceptions.cc.

635 {
636 ASSERT(thread->execution_state() == Thread::kThreadInVM);
637 const uword fp_for_clearing =
638 (clear_deopt_at_target ? frame_pointer + 1 : frame_pointer);
639 ClearLazyDeopts(thread, fp_for_clearing);
640
641#if defined(USING_SIMULATOR)
642 // Unwinding of the C++ frames and destroying of their stack resources is done
643 // by the simulator, because the target stack_pointer is a simulated stack
644 // pointer and not the C++ stack pointer.
645
646 // Continue simulating at the given pc in the given frame after setting up the
647 // exception object in the kExceptionObjectReg register and the stacktrace
648 // object (may be raw null) in the kStackTraceObjectReg register.
649
650 Simulator::Current()->JumpToFrame(program_counter, stack_pointer,
651 frame_pointer, thread);
652#else
653
654 // Prepare for unwinding frames by destroying all the stack resources
655 // in the previous frames.
656 StackResource::Unwind(thread);
657
658 // Unpoison the stack before we tear it down in the generated stub code.
659 uword current_sp = OSThread::GetCurrentStackPointer() - 1024;
660 ASAN_UNPOISON(reinterpret_cast<void*>(current_sp),
661 stack_pointer - current_sp);
662
663 // We are jumping over C++ frames, so we have to set the safestack pointer
664 // back to what it was when we entered the runtime from Dart code.
665#if defined(USING_SAFE_STACK)
666 const uword saved_ssp = thread->saved_safestack_limit();
667 OSThread::SetCurrentSafestackPointer(saved_ssp);
668#endif
669
670#if defined(USING_SHADOW_CALL_STACK)
671 // The shadow call stack register will be restored by the JumpToFrame stub.
672#endif
673
674#if defined(USING_THREAD_SANITIZER)
675 if (thread->exit_through_ffi() == Thread::kExitThroughRuntimeCall) {
676 auto tsan_utils = thread->tsan_utils();
677 tsan_utils->exception_pc = program_counter;
678 tsan_utils->exception_sp = stack_pointer;
679 tsan_utils->exception_fp = frame_pointer;
680 longjmp(*(tsan_utils->setjmp_buffer), 1);
681 }
682#endif // defined(USING_THREAD_SANITIZER)
683
684 // Call a stub to set up the exception object in kExceptionObjectReg,
685 // to set up the stacktrace object in kStackTraceObjectReg, and to
686 // continue execution at the given pc in the given frame.
687 typedef void (*ExcpHandler)(uword, uword, uword, Thread*);
688 ExcpHandler func =
689 reinterpret_cast<ExcpHandler>(StubCode::JumpToFrame().EntryPoint());
690
691 if (thread->is_unwind_in_progress()) {
692 thread->SetUnwindErrorInProgress(true);
693 }
694 func(program_counter, stack_pointer, frame_pointer, thread);
695
696#endif
697 UNREACHABLE();
698}
#define ASAN_UNPOISON(ptr, len)
static uword GetCurrentStackPointer()
Definition: os_thread.cc:132
void JumpToFrame(uword pc, uword sp, uword fp, Thread *thread)
static Simulator * Current()
static void Unwind(ThreadState *thread)
Definition: allocation.h:36
@ kExitThroughRuntimeCall
Definition: thread.h:472
static void ClearLazyDeopts(Thread *thread, uword frame_pointer)
Definition: exceptions.cc:580
uintptr_t uword
Definition: globals.h:501

◆ NewInstance()

InstancePtr dart::Exceptions::NewInstance ( const char *  class_name)
static

Definition at line 882 of file exceptions.cc.

882 {
883 Thread* thread = Thread::Current();
884 Zone* zone = thread->zone();
885 const String& cls_name =
886 String::Handle(zone, Symbols::New(thread, class_name));
887 const Library& core_lib = Library::Handle(Library::CoreLibrary());
888 // No ambiguity error expected: passing nullptr.
889 Class& cls = Class::Handle(core_lib.LookupClass(cls_name));
890 ASSERT(!cls.IsNull());
891 // There are no parameterized error types, so no need to set type arguments.
892 return Instance::New(cls);
893}
static InstancePtr New(const Class &cls, Heap::Space space=Heap::kNew)
Definition: object.cc:20935
static StringPtr New(Thread *thread, const char *cstr)
Definition: symbols.h:723

◆ PropagateError()

void dart::Exceptions::PropagateError ( const Error error)
static

Definition at line 1003 of file exceptions.cc.

1003 {
1004 ASSERT(!error.IsNull());
1005 Thread* thread = Thread::Current();
1006 // SuspendLongJumpScope during Dart entry ensures that if a longjmp base is
1007 // available, it is the innermost error handler. If one is available, so
1008 // should jump there instead.
1009 RELEASE_ASSERT(thread->long_jump_base() == nullptr);
1010 Zone* zone = thread->zone();
1011 if (error.IsUnhandledException()) {
1012 // If the error object represents an unhandled exception, then
1013 // rethrow the exception in the normal fashion.
1014 const UnhandledException& uhe = UnhandledException::Cast(error);
1015 const Instance& exc = Instance::Handle(zone, uhe.exception());
1016 const Instance& stk = Instance::Handle(zone, uhe.stacktrace());
1017 Exceptions::ReThrow(thread, exc, stk);
1018 } else {
1019 // Return to the invocation stub and return this error object. The
1020 // C++ code which invoked this dart sequence can check and do the
1021 // appropriate thing.
1022 uword handler_pc = 0;
1023 uword handler_sp = 0;
1024 uword handler_fp = 0;
1025 FindErrorHandler(&handler_pc, &handler_sp, &handler_fp);
1026 JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp, error,
1027 StackTrace::Handle(zone)); // Null stacktrace.
1028 }
1029 UNREACHABLE();
1030}
#define RELEASE_ASSERT(cond)
Definition: assert.h:327
static DART_NORETURN void ReThrow(Thread *thread, const Instance &exception, const Instance &stacktrace, bool bypass_debugger=false)
Definition: exceptions.cc:986
const uint8_t uint32_t uint32_t GError ** error
static void FindErrorHandler(uword *handler_pc, uword *handler_sp, uword *handler_fp)
Definition: exceptions.cc:562
static void JumpToExceptionHandler(Thread *thread, uword program_counter, uword stack_pointer, uword frame_pointer, const Object &exception_object, const Object &stacktrace_object)
Definition: exceptions.cc:612

◆ PropagateToEntry()

void dart::Exceptions::PropagateToEntry ( const Error error)
static

Definition at line 1032 of file exceptions.cc.

1032 {
1033 Thread* thread = Thread::Current();
1034 Zone* zone = thread->zone();
1035 ASSERT(thread->top_exit_frame_info() != 0);
1036 Instance& stacktrace = Instance::Handle(zone);
1037 if (error.IsUnhandledException()) {
1038 const UnhandledException& uhe = UnhandledException::Cast(error);
1039 stacktrace = uhe.stacktrace();
1040 } else {
1041 stacktrace = Exceptions::CurrentStackTrace();
1042 }
1043 uword handler_pc = 0;
1044 uword handler_sp = 0;
1045 uword handler_fp = 0;
1046 FindErrorHandler(&handler_pc, &handler_sp, &handler_fp);
1047 JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp, error,
1048 stacktrace);
1049 UNREACHABLE();
1050}
static StackTracePtr CurrentStackTrace()
Definition: exceptions.cc:726

◆ ReThrow()

void dart::Exceptions::ReThrow ( Thread thread,
const Instance exception,
const Instance stacktrace,
bool  bypass_debugger = false 
)
static

Definition at line 986 of file exceptions.cc.

989 {
990 // Null object is a valid exception object.
991 ThrowExceptionHelper(thread, exception, stacktrace, /*is_rethrow=*/true,
992 bypass_debugger);
993}
static DART_NORETURN void ThrowExceptionHelper(Thread *thread, const Instance &incoming_exception, const Instance &existing_stacktrace, const bool is_rethrow, const bool bypass_debugger)
Definition: exceptions.cc:731

◆ Throw()

void dart::Exceptions::Throw ( Thread thread,
const Instance exception 
)
static

Definition at line 979 of file exceptions.cc.

979 {
980 // Null object is a valid exception object.
981 ThrowExceptionHelper(thread, exception, StackTrace::Handle(thread->zone()),
982 /*is_rethrow=*/false,
983 /*bypass_debugger=*/false);
984}

◆ ThrowArgumentError()

void dart::Exceptions::ThrowArgumentError ( const Instance arg)
static

Definition at line 1082 of file exceptions.cc.

1082 {
1083 const Array& args = Array::Handle(Array::New(1));
1084 args.SetAt(0, arg);
1086}

◆ ThrowByType()

void dart::Exceptions::ThrowByType ( ExceptionType  type,
const Array arguments 
)
static

Definition at line 1052 of file exceptions.cc.

1052 {
1053 Thread* thread = Thread::Current();
1054 const Object& result =
1055 Object::Handle(thread->zone(), Create(type, arguments));
1056 if (result.IsError()) {
1057 // We got an error while constructing the exception object.
1058 // Propagate the error instead of throwing the exception.
1059 PropagateError(Error::Cast(result));
1060 } else {
1061 ASSERT(result.IsInstance());
1062 Throw(thread, Instance::Cast(result));
1063 }
1064}
static DART_NORETURN void Throw(Thread *thread, const Instance &exception)
Definition: exceptions.cc:979
static DART_NORETURN void PropagateError(const Error &error)
Definition: exceptions.cc:1003

◆ ThrowCompileTimeError()

void dart::Exceptions::ThrowCompileTimeError ( const LanguageError error)
static

Definition at line 1112 of file exceptions.cc.

1112 {
1113 const Array& args = Array::Handle(Array::New(1));
1114 args.SetAt(0, String::Handle(error.FormatMessage()));
1116}

◆ ThrowLateFieldAssignedDuringInitialization()

void dart::Exceptions::ThrowLateFieldAssignedDuringInitialization ( const String name)
static

Definition at line 1124 of file exceptions.cc.

1125 {
1126 const Array& args = Array::Handle(Array::New(1));
1127 args.SetAt(0, name);
1129 args);
1130}
const char *const name

◆ ThrowLateFieldNotInitialized()

void dart::Exceptions::ThrowLateFieldNotInitialized ( const String name)
static

Definition at line 1118 of file exceptions.cc.

1118 {
1119 const Array& args = Array::Handle(Array::New(1));
1120 args.SetAt(0, name);
1122}

◆ ThrowOOM()

void dart::Exceptions::ThrowOOM ( )
static

Definition at line 1066 of file exceptions.cc.

1066 {
1067 auto thread = Thread::Current();
1068 auto isolate_group = thread->isolate_group();
1069 const Instance& oom = Instance::Handle(
1070 thread->zone(), isolate_group->object_store()->out_of_memory());
1071 Throw(thread, oom);
1072}

◆ ThrowRangeError()

void dart::Exceptions::ThrowRangeError ( const char *  argument_name,
const Integer argument_value,
intptr_t  expected_from,
intptr_t  expected_to 
)
static

Definition at line 1094 of file exceptions.cc.

1097 {
1098 const Array& args = Array::Handle(Array::New(4));
1099 args.SetAt(0, argument_value);
1100 args.SetAt(1, Integer::Handle(Integer::New(expected_from)));
1101 args.SetAt(2, Integer::Handle(Integer::New(expected_to)));
1102 args.SetAt(3, String::Handle(String::New(argument_name)));
1104}
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
Definition: object.cc:22984

◆ ThrowStackOverflow()

void dart::Exceptions::ThrowStackOverflow ( )
static

Definition at line 1074 of file exceptions.cc.

1074 {
1075 auto thread = Thread::Current();
1076 auto isolate_group = thread->isolate_group();
1077 const Instance& stack_overflow = Instance::Handle(
1078 thread->zone(), isolate_group->object_store()->stack_overflow());
1079 Throw(thread, stack_overflow);
1080}

◆ ThrowStateError()

void dart::Exceptions::ThrowStateError ( const Instance arg)
static

Definition at line 1088 of file exceptions.cc.

1088 {
1089 const Array& args = Array::Handle(Array::New(1));
1090 args.SetAt(0, arg);
1092}

◆ ThrowUnsupportedError()

void dart::Exceptions::ThrowUnsupportedError ( const char *  msg)
static

Definition at line 1106 of file exceptions.cc.

1106 {
1107 const Array& args = Array::Handle(Array::New(1));
1108 args.SetAt(0, String::Handle(String::New(msg)));
1110}

◆ ThrowWithStackTrace()

void dart::Exceptions::ThrowWithStackTrace ( Thread thread,
const Instance exception,
const Instance stacktrace 
)
static

Definition at line 995 of file exceptions.cc.

997 {
998 // Null object is a valid exception object.
999 ThrowExceptionHelper(thread, exception, stacktrace, /*is_rethrow=*/false,
1000 /*bypass_debugger=*/false);
1001}

The documentation for this class was generated from the following files: