diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-19 16:33:29 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-19 16:33:29 +0100 |
commit | 2cd4a85ed4c57a705e3aeb88052be616e0461187 (patch) | |
tree | 7adf45ccda4eace9d350cb593ae19cd1151d300e /src/pages/confirm-create-reserve.tsx | |
parent | 50090b5fb44f9d3986064dfe9b6190b66cbe49bf (diff) |
better error reporting
Diffstat (limited to 'src/pages/confirm-create-reserve.tsx')
-rw-r--r-- | src/pages/confirm-create-reserve.tsx | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/pages/confirm-create-reserve.tsx b/src/pages/confirm-create-reserve.tsx index 963bd0697..81a90650c 100644 --- a/src/pages/confirm-create-reserve.tsx +++ b/src/pages/confirm-create-reserve.tsx @@ -374,14 +374,24 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> { } export async 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; - const wt_types = JSON.parse(query.wt_types); - try { + const url = URI(document.location.href); + const query: any = URI.parseQuery(url.query()); + let amount; + try { + amount = AmountJson.checked(JSON.parse(query.amount)); + } catch (e) { + throw Error(`Can't parse amount: ${e.message}`); + } + const callback_url = query.callback_url; + const bank_url = query.bank_url; + let wt_types; + try { + wt_types = JSON.parse(query.wt_types); + } catch (e) { + throw Error(`Can't parse wire_types: ${e.message}`); + } + const suggestedExchangeUrl = await getSuggestedExchange(amount.currency); let args = { wt_types, |