// FIXME: apparently this can't be called unless we're inside a Dart_Invoke, maybe need to move it to Script and keep track of that // - but this isn't feasible for things like cidart::getValue(), since it doesn't know of the current script // - possible hack solution: get the stacktrace and search for the invoke() command, if we don't find that then throw regularly // - PROBABLE SOLUTION: build dart runtime with exceptions enabled and throw regular C++ exception void throwException( const std::string &description ) { cidart::DartScope enterScope; Dart_Handle exceptionHandle = toDart( description ); CIDART_CHECK( Dart_ThrowException( exceptionHandle ) ); }
static void Canvas_setMatrix(Dart_NativeArguments args) { DartArgIterator it(args); Float64List matrix4 = it.GetNext<Float64List>(); if (it.had_exception()) return; ExceptionState es; GetReceiver<Canvas>(args)->setMatrix(matrix4, es); if (es.had_exception()) Dart_ThrowException(es.GetDartException(args, true)); }
static void SceneBuilder_pushTransform(Dart_NativeArguments args) { DartArgIterator it(args); Float64List matrix4 = it.GetNext<Float64List>(); if (it.had_exception()) return; ExceptionState es; GetReceiver<SceneBuilder>(args)->pushTransform(matrix4, es); if (es.had_exception()) Dart_ThrowException(es.GetDartException(args, true)); }
static void ImageShader_initWithImage(Dart_NativeArguments args) { DartArgIterator it(args); CanvasImage* image = it.GetNext<CanvasImage*>(); SkShader::TileMode tmx = it.GetNext<SkShader::TileMode>(); SkShader::TileMode tmy = it.GetNext<SkShader::TileMode>(); Float64List matrix4 = it.GetNext<Float64List>(); if (it.had_exception()) return; ExceptionState es; GetReceiver<ImageShader>(args)->initWithImage(image, tmx, tmy, matrix4, es); if (es.had_exception()) Dart_ThrowException(es.GetDartException(args, true)); }
void ThrowMeTheBall(Dart_NativeArguments arguments) { Dart_Handle object = Dart_GetNativeArgument(arguments, 0); Dart_ThrowException(object); }