File size: 1,158 Bytes
0bd62e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<script lang="ts">
	import { StatusTracker } from "@gradio/statustracker";

	import { _ } from "svelte-i18n";
	import { setupi18n } from "@gradio/core";

	setupi18n();

	export let is_embed: boolean;
	export let error: Error | undefined = undefined;
</script>

<StatusTracker
	i18n={$_}
	absolute={!is_embed}
	status="error"
	timer={false}
	queue_position={null}
	queue_size={null}
	translucent={true}
	autoscroll={false}
>
	<div class="error" slot="error">
		{#if error}
			{#if error.message}
				<p class="error-name">
					{error.message}
				</p>
			{/if}
			{#if error.stack}
				<pre class="error-stack"><code>{error.stack}</code></pre>
			{/if}
		{/if}
	</div>
</StatusTracker>

<style>
	.error {
		position: relative;
		width: 100%;
		padding: var(--size-4);
		color: var(--body-text-color);
		/* Status tracker sets `pointer-events: none`.
		Override it here so the user can scroll the element with `overflow: hidden`
		and copy and paste the error message */
		pointer-events: all;
	}

	.error-name {
		text-align: center;
	}

	.error-stack {
		width: 100%;
		overflow: scroll;
	}
</style>