From f3a500923ce57361046cbeb717f28f3f10dd26d9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Jun 2013 12:14:17 -0700 Subject: [PATCH] Catch and log errors parsing window state Previously if a read or parse error occurred the window would never show and the dev tools would be inaccessible. --- src/app/atom.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/atom.coffee b/src/app/atom.coffee index 121a0a83a..bac43b357 100644 --- a/src/app/atom.coffee +++ b/src/app/atom.coffee @@ -241,9 +241,15 @@ window.atom = windowState getWindowState: (keyPath) -> - return {} unless fsUtils.exists(@getWindowStatePath()) + windowStatePath = @getWindowStatePath() + return {} unless fsUtils.exists(windowStatePath) + + try + windowState = JSON.parse(fsUtils.read(windowStatePath) or '{}') + catch error + console.warn "Error parsing window state: #{windowStatePath}", error.stack, error + windowState = {} - windowState = JSON.parse(fsUtils.read(@getWindowStatePath()) or '{}') if keyPath _.valueForKeyPath(windowState, keyPath) else