Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uncaught embedded exceptions on gist loading #829

Merged
merged 1 commit into from
Jun 19, 2018
Merged
Show file tree
Hide file tree
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
26 changes: 14 additions & 12 deletions lib/embed/embed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ class PlaygroundMobile {
if (url.hasQuery) {
String id = url.queryParameters['id'];
if (isLegalGistId(id)) {
_showGist(id);
_storePreviousResult();
if (url.queryParameters['run'] == 'true') {
_handleRun();
}
_showGist(id).then((_) {
_storePreviousResult().then((_) {
if (url.queryParameters['run'] == 'true') {
_handleRun();
}
});
});
return;
}
}
Expand All @@ -128,8 +130,9 @@ class PlaygroundMobile {
return;
}

_showGist(gistId, run: page == 'run');
_storePreviousResult();
_showGist(gistId, run: page == 'run').then((_) {
_storePreviousResult();
});
}

void registerMessageToast() {
Expand Down Expand Up @@ -322,8 +325,8 @@ class PlaygroundMobile {
_clearOutput();
}

void _showGist(String gistId, {bool run: false}) {
gistLoader.loadGist(gistId).then((Gist gist) {
Future<void> _showGist(String gistId, {bool run: false}) {
return gistLoader.loadGist(gistId).then((Gist gist) {
_setGistDescription(gist.description);
_setGistId(gist.id);

Expand Down Expand Up @@ -509,7 +512,6 @@ class PlaygroundMobile {
Timer.run(() {
editor.resize();
});

_router = new Router()
..root.addRoute(name: 'home', defaultRoute: true, enter: showHome)
..root.addRoute(name: 'gist', path: '/:gist', enter: showGist)
Expand Down Expand Up @@ -601,10 +603,10 @@ class PlaygroundMobile {
_cachedCompile != null);
}

void _storePreviousResult() {
Future<void> _storePreviousResult() {
var input = new CompileRequest()..source = context.dartSource;
_setLastRunCondition();
dartServices
return dartServices
.compile(input)
.timeout(longServiceCallTimeout)
.then((CompileResponse response) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,4 @@ packages:
source: hosted
version: "2.1.13"
sdks:
dart: ">=2.0.0-dev.52.0 <=2.0.0-dev.59.0"
dart: ">=2.0.0-dev.52.0 <=2.0.0-dev.63.0"