<NME> default_viewer_setup.ts
<BEF> /**
 * @license
 * Copyright 2016 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import {makeDefaultViewer} from 'neuroglancer/ui/default_viewer';
import {bindDefaultCopyHandler, bindDefaultPasteHandler} from 'neuroglancer/ui/default_clipboard_handling';
import {setDefaultInputEventBindings} from 'neuroglancer/ui/default_input_event_bindings';
import {UrlHashBinding} from 'neuroglancer/ui/url_hash_binding';

/**
declare var NEUROGLANCER_DEFAULT_STATE_FRAGMENT: string|undefined;

/**
 * Sets up the default neuroglancer viewer.
  setDefaultInputEventBindings(viewer.inputEventBindings);

  const hashBinding = viewer.registerDisposer(new UrlHashBinding(viewer.state));
  hashBinding.updateFromUrlHash();

  bindDefaultCopyHandler(viewer);
      status.setErrorMessage(`Error parsing state: ${value.message}`);
      console.log('Error parsing state', value);
    }
    hashBinding.parseError;
  }));
  hashBinding.updateFromUrlHash();
  viewer.registerDisposer(bindTitle(viewer.title));

  bindDefaultCopyHandler(viewer);
  bindDefaultPasteHandler(viewer);

  return viewer;
}

<MSG> feat(default_viewer_setup): display errors from restoring state from URL fragment

<DFF> @@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-import {makeDefaultViewer} from 'neuroglancer/ui/default_viewer';
+import {StatusMessage} from 'neuroglancer/status';
 import {bindDefaultCopyHandler, bindDefaultPasteHandler} from 'neuroglancer/ui/default_clipboard_handling';
 import {setDefaultInputEventBindings} from 'neuroglancer/ui/default_input_event_bindings';
+import {makeDefaultViewer} from 'neuroglancer/ui/default_viewer';
 import {UrlHashBinding} from 'neuroglancer/ui/url_hash_binding';
 
 /**
@@ -27,6 +28,15 @@ export function setupDefaultViewer() {
   setDefaultInputEventBindings(viewer.inputEventBindings);
 
   const hashBinding = viewer.registerDisposer(new UrlHashBinding(viewer.state));
+  viewer.registerDisposer(hashBinding.parseError.changed.add(() => {
+    const {value} = hashBinding.parseError;
+    if (value !== undefined) {
+      const status = new StatusMessage();
+      status.setErrorMessage(`Error parsing state: ${value.message}`);
+      console.log('Error parsing state', value);
+    }
+    hashBinding.parseError;
+  }));
   hashBinding.updateFromUrlHash();
 
   bindDefaultCopyHandler(viewer);

feat(default_viewer_setup): display errors from restoring state from URL fragment