2015-12-25 22:42:14 +01:00
|
|
|
/*
|
|
|
|
This file is part of TALER
|
2016-01-26 17:21:17 +01:00
|
|
|
(C) 2015-2016 GNUnet e.V.
|
2015-12-25 22:42:14 +01:00
|
|
|
|
|
|
|
TALER is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3, or (at your option) any later version.
|
|
|
|
|
|
|
|
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
2016-07-07 17:59:29 +02:00
|
|
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
2015-12-25 22:42:14 +01:00
|
|
|
*/
|
|
|
|
|
2016-03-01 19:46:20 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Page shown to the user to confirm creation
|
|
|
|
* of a reserve, usually requested by the bank.
|
|
|
|
*
|
|
|
|
* @author Florian Dold
|
|
|
|
*/
|
|
|
|
|
2016-02-15 11:29:58 +01:00
|
|
|
/// <reference path="../lib/decl/mithril.d.ts" />
|
|
|
|
|
2016-02-11 11:29:57 +01:00
|
|
|
import {amountToPretty, canonicalizeBaseUrl} from "../lib/wallet/helpers";
|
|
|
|
import {AmountJson, CreateReserveResponse} from "../lib/wallet/types";
|
2016-02-15 11:29:58 +01:00
|
|
|
import m from "mithril";
|
2016-02-22 23:13:28 +01:00
|
|
|
import {ReserveCreationInfo, Amounts} from "../lib/wallet/types";
|
2016-02-18 22:50:17 +01:00
|
|
|
import MithrilComponent = _mithril.MithrilComponent;
|
|
|
|
import {Denomination} from "../lib/wallet/types";
|
2016-02-19 04:23:00 +01:00
|
|
|
import {getReserveCreationInfo} from "../lib/wallet/wxApi";
|
2016-02-11 11:29:57 +01:00
|
|
|
|
2015-12-20 20:34:20 +01:00
|
|
|
"use strict";
|
|
|
|
|
2016-02-11 11:29:57 +01:00
|
|
|
/**
|
|
|
|
* Execute something after a delay, with the possibility
|
|
|
|
* to reset the delay.
|
|
|
|
*/
|
|
|
|
class DelayTimer {
|
|
|
|
ms: number;
|
2016-09-12 20:25:56 +02:00
|
|
|
f: () => void;
|
|
|
|
timerId: number|undefined = undefined;
|
2016-02-11 11:29:57 +01:00
|
|
|
|
2016-09-12 20:25:56 +02:00
|
|
|
constructor(ms: number, f: () => void) {
|
2016-02-11 11:29:57 +01:00
|
|
|
this.f = f;
|
|
|
|
this.ms = ms;
|
|
|
|
}
|
|
|
|
|
|
|
|
bump() {
|
2016-02-15 11:29:58 +01:00
|
|
|
this.stop();
|
2016-02-11 11:29:57 +01:00
|
|
|
const handler = () => {
|
|
|
|
this.f();
|
|
|
|
};
|
|
|
|
this.timerId = window.setTimeout(handler, this.ms);
|
2015-12-20 20:34:20 +01:00
|
|
|
}
|
2016-02-15 11:29:58 +01:00
|
|
|
|
|
|
|
stop() {
|
2016-09-12 20:25:56 +02:00
|
|
|
if (this.timerId != undefined) {
|
2016-02-15 11:29:58 +01:00
|
|
|
window.clearTimeout(this.timerId);
|
|
|
|
}
|
|
|
|
}
|
2016-02-11 11:29:57 +01:00
|
|
|
}
|
2015-12-20 20:34:20 +01:00
|
|
|
|
2016-01-26 17:21:17 +01:00
|
|
|
|
2016-02-11 11:29:57 +01:00
|
|
|
class Controller {
|
2016-02-15 11:29:58 +01:00
|
|
|
url = m.prop<string>();
|
2016-09-12 20:25:56 +02:00
|
|
|
statusString: string | null = null;
|
2016-03-01 19:39:17 +01:00
|
|
|
isValidExchange = false;
|
2016-09-12 20:25:56 +02:00
|
|
|
reserveCreationInfo?: ReserveCreationInfo;
|
2016-02-11 11:29:57 +01:00
|
|
|
private timer: DelayTimer;
|
2016-02-15 11:29:58 +01:00
|
|
|
amount: AmountJson;
|
|
|
|
callbackUrl: string;
|
2016-04-06 02:06:57 +02:00
|
|
|
wtTypes: string[];
|
2016-02-18 22:50:17 +01:00
|
|
|
detailCollapsed = m.prop<boolean>(true);
|
2016-04-27 06:50:38 +02:00
|
|
|
suggestedExchangeUrl: string;
|
|
|
|
complexViewRequested = false;
|
|
|
|
urlOkay = false;
|
2015-12-20 20:34:20 +01:00
|
|
|
|
2016-04-27 06:50:38 +02:00
|
|
|
constructor(suggestedExchangeUrl: string,
|
2016-04-06 02:06:57 +02:00
|
|
|
amount: AmountJson,
|
|
|
|
callbackUrl: string,
|
|
|
|
wt_types: string[]) {
|
2016-02-18 22:50:17 +01:00
|
|
|
console.log("creating main controller");
|
2016-04-27 06:50:38 +02:00
|
|
|
this.suggestedExchangeUrl = suggestedExchangeUrl;
|
2016-02-15 11:29:58 +01:00
|
|
|
this.amount = amount;
|
|
|
|
this.callbackUrl = callbackUrl;
|
2016-04-06 02:06:57 +02:00
|
|
|
this.wtTypes = wt_types;
|
2016-02-11 11:29:57 +01:00
|
|
|
this.timer = new DelayTimer(800, () => this.update());
|
2016-04-27 06:50:38 +02:00
|
|
|
this.url(suggestedExchangeUrl);
|
2016-02-15 11:29:58 +01:00
|
|
|
this.update();
|
2016-02-11 11:29:57 +01:00
|
|
|
}
|
|
|
|
|
2016-02-15 11:29:58 +01:00
|
|
|
private update() {
|
|
|
|
this.timer.stop();
|
2016-02-11 11:29:57 +01:00
|
|
|
const doUpdate = () => {
|
2016-09-12 20:25:56 +02:00
|
|
|
this.reserveCreationInfo = undefined;
|
2016-02-15 11:29:58 +01:00
|
|
|
if (!this.url()) {
|
2016-04-27 06:50:38 +02:00
|
|
|
this.statusString = i18n`Error: URL is empty`;
|
|
|
|
m.redraw(true);
|
2016-02-11 11:29:57 +01:00
|
|
|
return;
|
|
|
|
}
|
2016-02-15 11:29:58 +01:00
|
|
|
this.statusString = null;
|
|
|
|
let parsedUrl = URI(this.url());
|
2016-02-11 11:29:57 +01:00
|
|
|
if (parsedUrl.is("relative")) {
|
2016-04-27 06:50:38 +02:00
|
|
|
this.statusString = i18n`Error: URL may not be relative`;
|
|
|
|
m.redraw(true);
|
2016-02-11 11:29:57 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-02-18 22:50:17 +01:00
|
|
|
m.redraw(true);
|
|
|
|
|
2016-03-01 19:39:17 +01:00
|
|
|
console.log("doing get exchange info");
|
2016-02-18 22:50:17 +01:00
|
|
|
|
|
|
|
getReserveCreationInfo(this.url(), this.amount)
|
|
|
|
.then((r: ReserveCreationInfo) => {
|
2016-03-01 19:39:17 +01:00
|
|
|
console.log("get exchange info resolved");
|
|
|
|
this.isValidExchange = true;
|
2016-02-18 22:50:17 +01:00
|
|
|
this.reserveCreationInfo = r;
|
|
|
|
console.dir(r);
|
|
|
|
m.endComputation();
|
|
|
|
})
|
|
|
|
.catch((e) => {
|
2016-03-01 19:39:17 +01:00
|
|
|
console.log("get exchange info rejected");
|
2016-02-18 22:50:17 +01:00
|
|
|
if (e.hasOwnProperty("httpStatus")) {
|
2016-09-12 20:25:56 +02:00
|
|
|
this.statusString = `Error: request failed with status ${e.httpStatus}`;
|
2016-04-22 18:03:56 +02:00
|
|
|
} else if (e.hasOwnProperty("errorResponse")) {
|
|
|
|
let resp = e.errorResponse;
|
2016-04-27 06:50:38 +02:00
|
|
|
this.statusString = `Error: ${resp.error} (${resp.hint})`;
|
2016-02-11 11:29:57 +01:00
|
|
|
}
|
2016-02-18 22:50:17 +01:00
|
|
|
m.endComputation();
|
|
|
|
});
|
2016-02-09 21:56:06 +01:00
|
|
|
};
|
|
|
|
|
2016-02-11 11:29:57 +01:00
|
|
|
doUpdate();
|
2016-02-15 11:29:58 +01:00
|
|
|
|
2016-04-27 06:50:38 +02:00
|
|
|
console.log("got update", this.url());
|
2016-02-11 11:29:57 +01:00
|
|
|
}
|
2015-12-20 20:34:20 +01:00
|
|
|
|
2016-02-11 11:29:57 +01:00
|
|
|
reset() {
|
2016-03-01 19:39:17 +01:00
|
|
|
this.isValidExchange = false;
|
2016-02-15 11:29:58 +01:00
|
|
|
this.statusString = null;
|
2016-09-12 20:25:56 +02:00
|
|
|
this.reserveCreationInfo = undefined;
|
2016-02-11 11:29:57 +01:00
|
|
|
}
|
2016-02-09 21:56:06 +01:00
|
|
|
|
2016-04-06 02:06:57 +02:00
|
|
|
confirmReserve(rci: ReserveCreationInfo,
|
|
|
|
exchange: string,
|
|
|
|
amount: AmountJson,
|
|
|
|
callback_url: string) {
|
2016-03-01 19:39:17 +01:00
|
|
|
const d = {exchange, amount};
|
2016-09-12 20:25:56 +02:00
|
|
|
const cb = (rawResp: any) => {
|
2016-02-09 21:56:06 +01:00
|
|
|
if (!rawResp) {
|
|
|
|
throw Error("empty response");
|
|
|
|
}
|
2016-04-06 02:06:57 +02:00
|
|
|
// FIXME: filter out types that bank/exchange don't have in common
|
|
|
|
let wire_details = rci.wireInfo;
|
2016-02-09 21:56:06 +01:00
|
|
|
if (!rawResp.error) {
|
|
|
|
const resp = CreateReserveResponse.checked(rawResp);
|
2016-04-06 02:06:57 +02:00
|
|
|
let q: {[name: string]: string|number} = {
|
|
|
|
wire_details: JSON.stringify(wire_details),
|
2016-03-01 19:39:17 +01:00
|
|
|
exchange: resp.exchange,
|
2016-02-09 21:56:06 +01:00
|
|
|
reserve_pub: resp.reservePub,
|
2016-02-11 11:29:57 +01:00
|
|
|
amount_value: amount.value,
|
|
|
|
amount_fraction: amount.fraction,
|
|
|
|
amount_currency: amount.currency,
|
2016-02-09 21:56:06 +01:00
|
|
|
};
|
2016-02-11 11:29:57 +01:00
|
|
|
let url = URI(callback_url).addQuery(q);
|
2016-02-09 21:56:06 +01:00
|
|
|
if (!url.is("absolute")) {
|
|
|
|
throw Error("callback url is not absolute");
|
|
|
|
}
|
2016-02-11 11:29:57 +01:00
|
|
|
console.log("going to", url.href());
|
2016-02-09 21:56:06 +01:00
|
|
|
document.location.href = url.href();
|
2016-01-26 17:21:17 +01:00
|
|
|
} else {
|
2016-02-11 11:29:57 +01:00
|
|
|
this.reset();
|
2016-02-15 11:29:58 +01:00
|
|
|
this.statusString = (
|
2016-02-11 11:29:57 +01:00
|
|
|
`Oops, something went wrong.` +
|
|
|
|
`The wallet responded with error status (${rawResp.error}).`);
|
2016-01-26 17:21:17 +01:00
|
|
|
}
|
|
|
|
};
|
2016-02-09 21:56:06 +01:00
|
|
|
chrome.runtime.sendMessage({type: 'create-reserve', detail: d}, cb);
|
2016-02-11 11:29:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
onUrlChanged(url: string) {
|
|
|
|
this.reset();
|
2016-02-15 11:29:58 +01:00
|
|
|
this.url(url);
|
2016-02-11 11:29:57 +01:00
|
|
|
this.timer.bump();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-27 06:50:38 +02:00
|
|
|
function view(ctrl: Controller): any {
|
2016-09-14 15:55:10 +02:00
|
|
|
function* f(): IterableIterator<any> {
|
2016-09-14 15:20:18 +02:00
|
|
|
yield m("p",
|
|
|
|
i18n.parts`You are about to withdraw ${m("strong", amountToPretty(
|
|
|
|
ctrl.amount))} from your bank account into your wallet.`);
|
|
|
|
|
|
|
|
if (ctrl.complexViewRequested || !ctrl.suggestedExchangeUrl) {
|
|
|
|
yield viewComplex(ctrl);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
yield viewSimple(ctrl);
|
|
|
|
}
|
|
|
|
return Array.from(f());
|
|
|
|
}
|
2016-04-23 19:34:30 +02:00
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
function viewSimple(ctrl: Controller) {
|
|
|
|
function *f() {
|
|
|
|
if (ctrl.statusString) {
|
|
|
|
yield m("p", "Error: ", ctrl.statusString);
|
|
|
|
yield m("button.linky", {
|
|
|
|
onclick: () => {
|
|
|
|
ctrl.complexViewRequested = true;
|
|
|
|
}
|
|
|
|
}, "advanced options");
|
|
|
|
}
|
|
|
|
else if (ctrl.reserveCreationInfo != undefined) {
|
|
|
|
yield m("button.accept", {
|
|
|
|
onclick: () => ctrl.confirmReserve(ctrl.reserveCreationInfo!,
|
|
|
|
ctrl.url(),
|
|
|
|
ctrl.amount,
|
|
|
|
ctrl.callbackUrl),
|
|
|
|
disabled: !ctrl.isValidExchange
|
|
|
|
},
|
|
|
|
"Accept fees and withdraw");
|
|
|
|
yield m("span.spacer");
|
|
|
|
yield m("button.linky", {
|
|
|
|
onclick: () => {
|
|
|
|
ctrl.complexViewRequested = true;
|
|
|
|
}
|
|
|
|
}, "advanced options");
|
|
|
|
let totalCost = Amounts.add(ctrl.reserveCreationInfo.overhead,
|
|
|
|
ctrl.reserveCreationInfo.withdrawFee).amount;
|
|
|
|
yield m("p", `Withdraw cost: ${amountToPretty(totalCost)}`);
|
|
|
|
} else {
|
|
|
|
yield m("p", "Please wait ...");
|
|
|
|
}
|
2016-04-27 06:50:38 +02:00
|
|
|
}
|
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
return Array.from(f());
|
2016-04-27 06:50:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
function viewComplex(ctrl: Controller) {
|
|
|
|
function *f() {
|
|
|
|
yield m("button.accept", {
|
2016-09-12 20:25:56 +02:00
|
|
|
onclick: () => ctrl.confirmReserve(ctrl.reserveCreationInfo!,
|
2016-04-27 06:50:38 +02:00
|
|
|
ctrl.url(),
|
|
|
|
ctrl.amount,
|
|
|
|
ctrl.callbackUrl),
|
|
|
|
disabled: !ctrl.isValidExchange
|
|
|
|
},
|
|
|
|
"Accept fees and withdraw");
|
2016-09-14 15:20:18 +02:00
|
|
|
yield m("span.spacer");
|
|
|
|
yield m("button.linky", {
|
2016-04-27 06:50:38 +02:00
|
|
|
onclick: () => {
|
2016-09-14 15:20:18 +02:00
|
|
|
ctrl.complexViewRequested = false;
|
2016-04-27 06:50:38 +02:00
|
|
|
}
|
2016-09-14 15:20:18 +02:00
|
|
|
}, "back to simple view");
|
2016-02-15 11:29:58 +01:00
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
yield m("br");
|
2016-04-27 06:50:38 +02:00
|
|
|
|
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
yield m("input", {
|
|
|
|
className: "url",
|
|
|
|
type: "text",
|
|
|
|
spellcheck: false,
|
|
|
|
value: ctrl.url(),
|
|
|
|
oninput: m.withAttr("value", ctrl.onUrlChanged.bind(ctrl)),
|
|
|
|
});
|
2016-04-27 06:50:38 +02:00
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
yield m("br");
|
2016-02-15 11:29:58 +01:00
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
if (ctrl.statusString) {
|
|
|
|
yield m("p", ctrl.statusString);
|
|
|
|
} else if (!ctrl.reserveCreationInfo) {
|
|
|
|
yield m("p", "Checking URL, please wait ...");
|
|
|
|
}
|
2016-02-11 11:29:57 +01:00
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
if (ctrl.reserveCreationInfo) {
|
|
|
|
let totalCost = Amounts.add(ctrl.reserveCreationInfo.overhead,
|
|
|
|
ctrl.reserveCreationInfo.withdrawFee).amount;
|
|
|
|
yield m("p", `Withdraw cost: ${amountToPretty(totalCost)}`);
|
|
|
|
if (ctrl.detailCollapsed()) {
|
|
|
|
yield m("button.linky", {
|
|
|
|
onclick: () => {
|
|
|
|
ctrl.detailCollapsed(false);
|
|
|
|
}
|
|
|
|
}, "show more details");
|
|
|
|
} else {
|
|
|
|
yield m("button.linky", {
|
|
|
|
onclick: () => {
|
|
|
|
ctrl.detailCollapsed(true);
|
|
|
|
}
|
|
|
|
}, "hide details");
|
|
|
|
yield m("div", {}, renderReserveCreationDetails(ctrl.reserveCreationInfo))
|
|
|
|
}
|
2016-02-18 22:50:17 +01:00
|
|
|
}
|
|
|
|
}
|
2016-09-14 15:20:18 +02:00
|
|
|
return Array.from(f());
|
2016-02-15 11:29:58 +01:00
|
|
|
}
|
2016-02-11 11:29:57 +01:00
|
|
|
|
|
|
|
|
2016-02-22 23:13:28 +01:00
|
|
|
function renderReserveCreationDetails(rci: ReserveCreationInfo) {
|
|
|
|
let denoms = rci.selectedDenoms;
|
|
|
|
|
2016-09-12 20:25:56 +02:00
|
|
|
let countByPub: {[s: string]: number} = {};
|
|
|
|
let uniq: Denomination[] = [];
|
2016-04-27 06:03:04 +02:00
|
|
|
|
|
|
|
denoms.forEach((x: Denomination) => {
|
|
|
|
let c = countByPub[x.denom_pub] || 0;
|
|
|
|
if (c == 0) {
|
|
|
|
uniq.push(x);
|
|
|
|
}
|
|
|
|
c += 1;
|
|
|
|
countByPub[x.denom_pub] = c;
|
|
|
|
});
|
|
|
|
|
2016-02-18 22:50:17 +01:00
|
|
|
function row(denom: Denomination) {
|
|
|
|
return m("tr", [
|
2016-04-27 06:03:04 +02:00
|
|
|
m("td", countByPub[denom.denom_pub] + "x"),
|
2016-02-18 22:50:17 +01:00
|
|
|
m("td", amountToPretty(denom.value)),
|
|
|
|
m("td", amountToPretty(denom.fee_withdraw)),
|
|
|
|
m("td", amountToPretty(denom.fee_refresh)),
|
|
|
|
m("td", amountToPretty(denom.fee_deposit)),
|
|
|
|
]);
|
|
|
|
}
|
2016-02-22 23:13:28 +01:00
|
|
|
|
|
|
|
let withdrawFeeStr = amountToPretty(rci.withdrawFee);
|
|
|
|
let overheadStr = amountToPretty(rci.overhead);
|
|
|
|
return [
|
|
|
|
m("p", `Fee for withdrawal: ${withdrawFeeStr}`),
|
|
|
|
m("p", `Overhead: ${overheadStr}`),
|
|
|
|
m("table", [
|
|
|
|
m("tr", [
|
2016-04-27 06:03:04 +02:00
|
|
|
m("th", "Count"),
|
2016-02-22 23:13:28 +01:00
|
|
|
m("th", "Value"),
|
|
|
|
m("th", "Withdraw Fee"),
|
|
|
|
m("th", "Refresh Fee"),
|
|
|
|
m("th", "Deposit Fee"),
|
|
|
|
]),
|
2016-04-27 06:03:04 +02:00
|
|
|
uniq.map(row)
|
2016-02-22 23:13:28 +01:00
|
|
|
])
|
|
|
|
];
|
2016-02-18 22:50:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-03-01 19:39:17 +01:00
|
|
|
function getSuggestedExchange(currency: string): Promise<string> {
|
2016-02-15 11:29:58 +01:00
|
|
|
// TODO: make this request go to the wallet backend
|
|
|
|
// Right now, this is a stub.
|
2016-09-12 20:25:56 +02:00
|
|
|
const defaultExchange: {[s: string]: string} = {
|
2016-03-05 12:17:46 +01:00
|
|
|
"KUDOS": "https://exchange.demo.taler.net",
|
|
|
|
"PUDOS": "https://exchange.test.taler.net",
|
2016-02-11 11:29:57 +01:00
|
|
|
};
|
|
|
|
|
2016-03-01 19:39:17 +01:00
|
|
|
let exchange = defaultExchange[currency];
|
2016-02-15 11:29:58 +01:00
|
|
|
|
2016-03-01 19:39:17 +01:00
|
|
|
if (!exchange) {
|
|
|
|
exchange = ""
|
2016-02-15 11:29:58 +01:00
|
|
|
}
|
|
|
|
|
2016-03-01 19:39:17 +01:00
|
|
|
return Promise.resolve(exchange);
|
2016-02-15 11:29:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-14 15:20:18 +02:00
|
|
|
|
2016-02-15 11:29:58 +01:00
|
|
|
export function main() {
|
|
|
|
const url = URI(document.location.href);
|
|
|
|
const query: any = URI.parseQuery(url.query());
|
|
|
|
const amount = AmountJson.checked(JSON.parse(query.amount));
|
|
|
|
const callback_url = query.callback_url;
|
|
|
|
const bank_url = query.bank_url;
|
2016-04-06 02:06:57 +02:00
|
|
|
const wt_types = JSON.parse(query.wt_types);
|
2016-02-15 11:29:58 +01:00
|
|
|
|
2016-03-01 19:39:17 +01:00
|
|
|
getSuggestedExchange(amount.currency)
|
|
|
|
.then((suggestedExchangeUrl) => {
|
2016-09-14 15:20:18 +02:00
|
|
|
const controller = function () { return new Controller(suggestedExchangeUrl, amount, callback_url, wt_types); };
|
2016-09-14 15:55:10 +02:00
|
|
|
const ExchangeSelection = {controller, view};
|
|
|
|
m.mount(document.getElementById("exchange-selection")!, ExchangeSelection);
|
2016-02-15 11:29:58 +01:00
|
|
|
})
|
|
|
|
.catch((e) => {
|
|
|
|
// TODO: provide more context information, maybe factor it out into a
|
|
|
|
// TODO:generic error reporting function or component.
|
|
|
|
document.body.innerText = `Fatal error: "${e.message}".`;
|
2016-09-14 15:20:18 +02:00
|
|
|
console.error(`got error "${e.message}"`, e);
|
2016-02-15 11:29:58 +01:00
|
|
|
});
|
2016-09-14 15:20:18 +02:00
|
|
|
}
|