File tree 1 file changed +13
-6
lines changed
projects/igniteui-angular/src/lib/icon
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -139,18 +139,25 @@ export class IgxIconService {
139
139
140
140
// load – when the result is ready, that includes HTTP errors like 404.
141
141
httpRequest . onload = function ( event : ProgressEvent ) {
142
- const request = event . target as XMLHttpRequest ;
143
- if ( request . status === 200 ) {
144
- instance . cacheSvgIcon ( iconName , request . responseText , fontSet ) ;
142
+ if ( event ) {
143
+ const request = event . target as XMLHttpRequest ;
144
+ if ( request . status === 200 ) {
145
+ instance . cacheSvgIcon ( iconName , request . responseText , fontSet ) ;
146
+ } else {
147
+ throw new Error ( `Could not fetch SVG from url: ${ url } ; error: ${ request . status } (${ request . statusText } )` ) ;
148
+ }
145
149
} else {
146
- throw new Error ( `Could not fetch SVG from url: ${ url } ; error: ${ request . status } ( ${ request . statusText } ) ` ) ;
150
+ throw new Error ( `Could not fetch SVG from url: ${ url } ;` ) ;
147
151
}
148
152
} ;
149
153
150
154
// error – when the request couldn’t be made, e.g.network down or invalid URL.
151
155
httpRequest . onerror = function ( event : ProgressEvent ) {
152
- const request = event . target as XMLHttpRequest ;
153
- throw new Error ( `Could not fetch SVG from url: ${ url } ; error status code: ${ request . status } (${ request . statusText } )` ) ;
156
+ if ( event ) {
157
+ const request = event . target as XMLHttpRequest ;
158
+ throw new Error ( `Could not fetch SVG from url: ${ url } ; error status code: ${ request . status } (${ request . statusText } )` ) ;
159
+ }
160
+ throw new Error ( `Could not fetch SVG from url: ${ url } ;` ) ;
154
161
} ;
155
162
156
163
httpRequest . send ( ) ;
You can’t perform that action at this time.
0 commit comments