Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/runtime/runtime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,20 @@ class Runtime<T> {
final context = Context.fromNextInvocation(nextInvocation);

final func = _handlers[context.handler];
if(func == null) {
throw RuntimeException('No handler with name "${context.handler}" registered in runtime!');
if (func == null) {
throw RuntimeException(
'No handler with name "${context.handler}" registered in runtime!');
}
final event =
Event.fromHandler(func.type, await nextInvocation.response);
final result = await func.handler(context, event);

await _client.postInvocationResponse(result);
} on Exception catch (error, stacktrace) {
await _client.postInvocationError(
nextInvocation.requestId, InvocationError(error, stacktrace));
if (nextInvocation != null) {
await _client.postInvocationError(
nextInvocation.requestId, InvocationError(error, stacktrace));
}
}

nextInvocation = null;
Expand Down