Skip to content

Idea: Wrap the individual scripts inside concattenation with try...catch #54

@akirk

Description

@akirk

When using unconcattenated JS, websites can continue to function if a single script has an error. If now these scripts are concattenated, it can result in very random errors (and this makes this especially hard to debug!) because not only the single script is not fully executed but all other scripts in the same concattenated JS file (see for example Automattic/jetpack#18187).

So I had this idea that we could wrap the since JS scripts in try { ... } catch (e) {} constructs. So instead of this:

script1;script2;script3

we'd have

try{ script1 } catch (e); try{ script2 } catch (e);try{ script3 } catch (e);

If now an error occurs in the script while executing it, it won't bring the whole cascade down but would drop out of the single try...catch block, thus not causing more failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions