serializable structured errors
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
<script>
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { getRootCause } from '../lib/errors.js';
|
||||
import Button from '../ui/Button.svelte';
|
||||
|
||||
export let appState;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let error = null;
|
||||
let errorMsg = null;
|
||||
let passphrase = '';
|
||||
async function unlock() {
|
||||
console.log('invoking unlock command.')
|
||||
@ -23,14 +24,20 @@
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
error = e;
|
||||
window.error = e;
|
||||
if (e.code === 'GetSession') {
|
||||
let root = getRootCause(e);
|
||||
errorMsg = `Error response from AWS (${root.code}): ${root.msg}`;
|
||||
}
|
||||
else {
|
||||
errorMsg = e.msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if error}
|
||||
<div class="text-red-400">{error}</div>
|
||||
{#if errorMsg}
|
||||
<div class="text-red-400">{errorMsg}</div>
|
||||
{/if}
|
||||
|
||||
<form action="#" on:submit|preventDefault="{unlock}">
|
||||
|
Reference in New Issue
Block a user