File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ function ensureImageSource() {
6969export function request ( options : http . HttpRequestOptions ) : Promise < http . HttpResponse > {
7070 return new Promise < http . HttpResponse > ( ( resolve , reject ) => {
7171
72+ if ( ! options . url ) {
73+ reject ( 'Request url was empty.' ) ;
74+ return ;
75+ }
76+
7277 try {
7378 var network = domainDebugger . getNetwork ( ) ;
7479 var debugRequest = network && network . create ( ) ;
Original file line number Diff line number Diff line change @@ -31,9 +31,18 @@ export function getJSON<T>(arg: any): Promise<T> {
3131}
3232
3333export function getImage ( arg : any ) : Promise < ImageSource > {
34- return httpRequest
35- . request ( typeof arg === "string" ? { url : arg , method : "GET" } : arg )
36- . then ( response => response . content . toImage ( ) ) ;
34+ return new Promise < any > ( ( resolve , reject ) => {
35+ httpRequest . request ( typeof arg === "string" ? { url : arg , method : "GET" } : arg )
36+ . then ( r => {
37+ try {
38+ resolve ( r . content . toImage ( ) ) ;
39+ } catch ( err ) {
40+ reject ( err ) ;
41+ }
42+ } , err => {
43+ reject ( err ) ;
44+ } ) ;
45+ } ) ;
3746}
3847
3948export function getFile ( arg : any , destinationFilePath ?: string ) : Promise < any > {
You can’t perform that action at this time.
0 commit comments