diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts b/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts index 391932574..fdca78ee5 100644 --- a/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts +++ b/packages/taler-wallet-webextension/src/components/TermsOfService/utils.ts @@ -14,7 +14,11 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { ExchangeTosStatus, GetExchangeTosResult } from "@gnu-taler/taler-util"; +import { + ExchangeTosStatus, + GetExchangeTosResult, + Logger, +} from "@gnu-taler/taler-util"; export function buildTermsOfServiceState( tos: GetExchangeTosResult, @@ -27,6 +31,8 @@ export function buildTermsOfServiceState( return { content, status: tos.tosStatus, version: tos.currentEtag }; } +const logger = new Logger("termsofservice"); + function parseTermsOfServiceContent( type: string, text: string, @@ -36,28 +42,28 @@ function parseTermsOfServiceContent( const document = new DOMParser().parseFromString(text, "text/xml"); return { type: "xml", document }; } catch (e) { - console.log(e); + logger.error("error parsing xml", e); } } else if (type === "text/html") { try { const href = new URL(text); return { type: "html", href }; } catch (e) { - console.log(e); + logger.error("error parsing url", e); } } else if (type === "text/json") { try { const data = JSON.parse(text); return { type: "json", data }; } catch (e) { - console.log(e); + logger.error("error parsing json", e); } } else if (type === "text/pdf") { try { const location = new URL(text); return { type: "pdf", location }; } catch (e) { - console.log(e); + logger.error("error parsing url", e); } } const content = text; |