Rename BeforeLoadScriptFailed to BeforeLoadScriptError, refactor.