Flutter Engine
The Flutter Engine
|
Namespaces | |
namespace | DartError |
Typedefs | |
typedef void(* | DartWrappableAccepter) (DartWrappable *) |
Enumerations | |
enum | DartErrorHandleType { kNoError , kUnknownErrorType , kApiErrorType , kCompilationErrorType } |
Functions | |
void | Log (const char *format,...) |
void | SetLogHandler (std::function< void(const char *)> handler) |
Dart_Handle | LookupNonNullableType (const std::string &library_name, const std::string &type_name) |
template<typename T , std::enable_if_t< std::is_same< std::string, T >::value, int > = 0> | |
Dart_Handle | ToDartTypeHandle () |
template<typename T > | |
Dart_Handle | CreateZeroInitializedDartObject (Dart_Handle type_handle_or_null=::Dart_Null()) |
template<typename T > | |
Dart_Handle | ToDart (const T &object) |
Dart_Handle | StdStringToDart (const std::string &val) |
std::string | StdStringFromDart (Dart_Handle handle) |
Dart_Handle | ToDart (const char *val) |
template<typename T > | |
void | DartReturn (T result, Dart_NativeArguments args) |
template<typename Sig > | |
void | DartCall (Sig func, Dart_NativeArguments args) |
template<typename Sig > | |
void | DartCallStatic (Sig func, Dart_NativeArguments args) |
template<typename Sig > | |
void | DartCallConstructor (Sig func, Dart_NativeArguments args) |
template<typename Arg , typename... Args> | |
void | WriteFfiArguments (std::ostringstream *stream) |
template<typename Arg , typename... Args> | |
void | WriteDartArguments (std::ostringstream *stream) |
template<typename Arg , typename... Args> | |
bool | AllowedInLeafCall () |
template<typename T > | |
T * | GetReceiver (Dart_NativeArguments args) |
void | SetUnhandledExceptionReporter (DartError::UnhandledExceptionReporter reporter) |
bool | CheckAndHandleError (Dart_Handle handle) |
DartErrorHandleType | GetErrorHandleType (Dart_Handle handle) |
int | GetErrorExitCode (Dart_Handle handle) |
Dart_Handle | DartInvokeField (Dart_Handle target, const char *name, std::initializer_list< Dart_Handle > args) |
Dart_Handle | DartInvoke (Dart_Handle closure, std::initializer_list< Dart_Handle > args) |
Dart_Handle | DartInvokeVoid (Dart_Handle closure) |
typedef void(* tonic::DartWrappableAccepter) (DartWrappable *) |
Definition at line 13 of file dart_wrapper_info.h.
Enumerator | |
---|---|
kNoError | |
kUnknownErrorType | |
kApiErrorType | |
kCompilationErrorType |
Definition at line 67 of file dart_error.h.
bool tonic::AllowedInLeafCall | ( | ) |
Definition at line 295 of file dart_args.h.
bool tonic::CheckAndHandleError | ( | Dart_Handle | handle | ) |
Check if a Dart_Handle is an error or exception.
If it is an error or exception, this method will return true.
If it is an unhandled error or exception, the closure in |SetUnhandledExceptionReporter| is called. The DartVMInitializer provides that closure, which checks with UIDartState::Current() if it is available and falls back to simply printing the exception and stack to an error log if the settings callback is not provided.
If UIDartState::Current() is available, it can provide an onError callback that forwards to PlatformConfiguration.instance.onError
. If that callback is not set, the callback from Settings.unhandled_exception_callback
is invoked. If that callback is not set, a simple error log is printed.
If the PlatformDispatcher callback throws an exception, the at least two separate exceptions and stacktraces will be handled by either the Settings.unhandled_exception_callback or the error printer: one for the original exception, and one for the exception thrown in the callback. If the callback returns false, the original exception and stacktrace are logged. If it returns true, no additional logging is done.
Leaving the PlatformDispatcher.instance.onError callback unset or returning false from it matches the behavior of Flutter applications before the introduction of PlatformDispatcher.onError, which is to print to the error log.
Dart has errors that are not considered unhandled exceptions, such as Dart_* API usage errors. In these cases, Dart_IsUnhandledException
returns false but Dart_IsError
returns true. Such errors are logged to stderr or some similar mechanism provided by the platform such as logcat on Android. Depending on which type of error occurs, the process may crash and the Dart isolate may be unusable. Errors that fall into this category include compilation errors, Dart API errors, and unwind errors that will terminate the Dart VM.
Historically known as LogIfError.
Definition at line 33 of file dart_error.cc.
Dart_Handle tonic::CreateZeroInitializedDartObject | ( | Dart_Handle | type_handle_or_null = ::Dart_Null() | ) |
Definition at line 432 of file dart_converter.h.
void tonic::DartCall | ( | Sig | func, |
Dart_NativeArguments | args | ||
) |
Definition at line 210 of file dart_args.h.
void tonic::DartCallConstructor | ( | Sig | func, |
Dart_NativeArguments | args | ||
) |
Definition at line 230 of file dart_args.h.
void tonic::DartCallStatic | ( | Sig | func, |
Dart_NativeArguments | args | ||
) |
Definition at line 220 of file dart_args.h.
Dart_Handle tonic::DartInvoke | ( | Dart_Handle | closure, |
std::initializer_list< Dart_Handle > | args | ||
) |
Definition at line 20 of file dart_invoke.cc.
Dart_Handle tonic::DartInvokeField | ( | Dart_Handle | target, |
const char * | name, | ||
std::initializer_list< Dart_Handle > | args | ||
) |
Definition at line 12 of file dart_invoke.cc.
Dart_Handle tonic::DartInvokeVoid | ( | Dart_Handle | closure | ) |
Definition at line 29 of file dart_invoke.cc.
void tonic::DartReturn | ( | T | result, |
Dart_NativeArguments | args | ||
) |
Definition at line 99 of file dart_args.h.
int tonic::GetErrorExitCode | ( | Dart_Handle | handle | ) |
Definition at line 68 of file dart_error.cc.
DartErrorHandleType tonic::GetErrorHandleType | ( | Dart_Handle | handle | ) |
Definition at line 56 of file dart_error.cc.
|
inline |
Definition at line 198 of file dart_wrappable.h.
void tonic::Log | ( | const char * | format, |
... | |||
) |
Definition at line 19 of file log.cc.
|
inline |
Definition at line 396 of file dart_converter.h.
void tonic::SetLogHandler | ( | std::function< void(const char *)> | handler | ) |
void tonic::SetUnhandledExceptionReporter | ( | DartError::UnhandledExceptionReporter | reporter | ) |
The fallback mechanism to log errors if the platform configuration error handler returns false.
Normally, UIDartState registers with this method in its constructor.
Definition at line 28 of file dart_error.cc.
|
inline |
Definition at line 590 of file dart_converter.h.
|
inline |
Definition at line 586 of file dart_converter.h.
|
inline |
Definition at line 595 of file dart_converter.h.
Dart_Handle tonic::ToDart | ( | const T & | object | ) |
Definition at line 579 of file dart_converter.h.
Dart_Handle tonic::ToDartTypeHandle | ( | ) |
Definition at line 416 of file dart_converter.h.
void tonic::WriteDartArguments | ( | std::ostringstream * | stream | ) |
Definition at line 283 of file dart_args.h.
void tonic::WriteFfiArguments | ( | std::ostringstream * | stream | ) |
Definition at line 270 of file dart_args.h.