File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
projects/igniteui-angular/src/lib/icon Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -139,18 +139,25 @@ export class IgxIconService {
139139
140140 // load – when the result is ready, that includes HTTP errors like 404.
141141 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+ }
145149 } 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 } ;` ) ;
147151 }
148152 } ;
149153
150154 // error – when the request couldn’t be made, e.g.network down or invalid URL.
151155 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 } ;` ) ;
154161 } ;
155162
156163 httpRequest . send ( ) ;
You can’t perform that action at this time.
0 commit comments