File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
packages-exp/auth-exp/src/platform_browser Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,15 @@ function getScriptParentElement(): HTMLDocument | HTMLHeadElement {
25
25
export function _loadJS ( url : string ) : Promise < Event > {
26
26
// TODO: consider adding timeout support & cancellation
27
27
return new Promise ( ( resolve , reject ) => {
28
+ function onError ( e : Event | string ) : void {
29
+ const errorEvent = e as ErrorEvent ;
30
+ const error = typeof errorEvent !== 'string' && errorEvent . error ? errorEvent . error : _createError ( AuthErrorCode . INTERNAL_ERROR ) ;
31
+ reject ( error ) ;
32
+ }
28
33
const el = document . createElement ( 'script' ) ;
29
34
el . setAttribute ( 'src' , url ) ;
30
35
el . onload = resolve ;
31
- el . onerror = ( ) => reject ( _createError ( AuthErrorCode . INTERNAL_ERROR ) ) ;
36
+ el . onerror = onError ;
32
37
el . type = 'text/javascript' ;
33
38
el . charset = 'UTF-8' ;
34
39
getScriptParentElement ( ) . appendChild ( el ) ;
You can’t perform that action at this time.
0 commit comments