From 492225694e8cf3d6f622e8610d680ff28acfcc88 Mon Sep 17 00:00:00 2001 From: Gaurav Munjal Date: Mon, 26 Oct 2015 10:20:06 -0400 Subject: [PATCH 1/2] Create loud error on save --- app/gist/route.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/gist/route.js b/app/gist/route.js index fdaa8db1..1b393712 100644 --- a/app/gist/route.js +++ b/app/gist/route.js @@ -36,7 +36,7 @@ export default Ember.Route.extend({ } else { this.send('setSaved'); } - }); + }).catch((this.catchSaveError.bind(this))); }, setSaved () { @@ -84,7 +84,18 @@ export default Ember.Route.extend({ if (error && error.errors) { let firstError = error.errors[0]; if (firstError.code === "unprocessable" && firstError.field === "forks") { - this.get('notify').info("You already own this gist."); + this.get('notify').error("You already own this gist."); + return; + } + } + throw error; + }, + + catchSaveError(error) { + if (error && error.errors) { + let firstError = error.errors[0]; + if (firstError.code === "unprocessable") { + this.get('notify').error("The gist is invalid, and could not be saved."); return; } } From 769ffed1741daa8fb5152ba894895a3ac9dec1bc Mon Sep 17 00:00:00 2001 From: Gaurav Munjal Date: Mon, 26 Oct 2015 10:38:34 -0400 Subject: [PATCH 2/2] If saving or forking goes wrong, loud error --- app/gist/route.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/gist/route.js b/app/gist/route.js index 1b393712..dfb56df2 100644 --- a/app/gist/route.js +++ b/app/gist/route.js @@ -88,6 +88,7 @@ export default Ember.Route.extend({ return; } } + this.get('notify').error("Something went wrong. The gist was not forked."); throw error; }, @@ -99,6 +100,7 @@ export default Ember.Route.extend({ return; } } + this.get('notify').error("Something went wrong. The gist was not saved."); throw error; } });