• Sean Hammond's avatar
    Don't throw on invalid JSON · a6869f48
    Sean Hammond authored
    Don't throw an error when parsing an invalid js-hypothesis-config JSON
    script.
    
    This error thrown by shared.settings#jsonConfigsFrom() was caught in one
    of the places where that function is called, but not in other places
    where it's called.
    
    Move the error catching and warning logging into the shared function
    instead.
    
    This now means, for example, that boot/index.js no longer crashes
    (bringing down the entire app) if the host page contains an invalid
    js-hypothesis-config.
    
    Unfortunately since jsonConfigsFrom() is called _twice_ on page load to
    read the same js-hypothesis-config objects from the host page (it's
    called once by boot/index.js and once by annotator/config/config.js) if
    there's an invalid js-hypothesis-config a warning about it will be
    logged twice.
    a6869f48
index-test.js 7.48 KB