File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
packages-exp/auth-exp/src/platform_browser Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -25,18 +25,14 @@ 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 =
31
- typeof errorEvent !== 'string' && errorEvent . error
32
- ? errorEvent . error
33
- : _createError ( AuthErrorCode . INTERNAL_ERROR ) ;
34
- reject ( error ) ;
35
- }
36
28
const el = document . createElement ( 'script' ) ;
37
29
el . setAttribute ( 'src' , url ) ;
38
30
el . onload = resolve ;
39
- el . onerror = onError ;
31
+ el . onerror = e => {
32
+ const error = _createError ( AuthErrorCode . INTERNAL_ERROR ) ;
33
+ error . customData = e as unknown as Record < string , unknown > ;
34
+ reject ( error ) ;
35
+ } ;
40
36
el . type = 'text/javascript' ;
41
37
el . charset = 'UTF-8' ;
42
38
getScriptParentElement ( ) . appendChild ( el ) ;
You can’t perform that action at this time.
0 commit comments