| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0c3ecbc commit 5cd8a1f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ export function getJSON<T>(arg: any): Promise<T> { | |||
| 33 | 33 | export function getImage(arg: any): Promise<ImageSource> { | |
| 34 | 34 | return httpRequest | |
| 35 | 35 | .request(typeof arg === "string" ? { url: arg, method: "GET" } : arg) | |
| 36 | - .then(responce => responce.content.toImage()); | ||
| 36 | + .then(response => response.content.toImage()); | ||
| 37 | 37 | } | |
| 38 | 38 | ||
| 39 | 39 | export function getFile(arg: any, destinationFilePath?: string): Promise<any> { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,8 @@ | |||
| 1 | 1 | import { Image as ImageDefinition, Stretch } from "."; | |
| 2 | - import { View, Property, InheritedCssProperty, Length, Style, Color, isIOS, booleanConverter, CSSType } from "../core/view"; | ||
| 2 | + import { View, Property, InheritedCssProperty, Length, Style, Color, isIOS, booleanConverter, CSSType, traceEnabled, traceWrite, traceCategories } from "../core/view"; | ||
| 3 | 3 | import { ImageAsset } from "../../image-asset"; | |
| 4 | 4 | import { ImageSource, fromAsset, fromNativeSource, fromUrl } from "../../image-source"; | |
| 5 | 5 | import { isDataURI, isFileOrResourcePath, RESOURCE_PREFIX } from "../../utils/utils"; | |
| 6 | - | ||
| 7 | 6 | export * from "../core/view"; | |
| 8 | 7 | export { ImageSource, ImageAsset, fromAsset, fromNativeSource, fromUrl, isDataURI, isFileOrResourcePath, RESOURCE_PREFIX }; | |
| 9 | 8 | ||
@@ -83,6 +82,15 @@ export abstract class ImageBase extends View implements ImageDefinition { | |||
| 83 | 82 | this.imageSource = r; | |
| 84 | 83 | this.isLoading = false; | |
| 85 | 84 | } | |
| 85 | + }, err => { | ||
| 86 | + // catch: Response content may not be converted to an Image | ||
| 87 | + this.isLoading = false; | ||
| 88 | + if (traceEnabled()) { | ||
| 89 | + if (typeof err === "object" && err.message) { | ||
| 90 | + err = err.message; | ||
| 91 | + } | ||
| 92 | + traceWrite(err, traceCategories.Debug); | ||
| 93 | + } | ||
| 86 | 94 | }); | |
| 87 | 95 | } | |
| 88 | 96 | } else if (value instanceof ImageSource) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments