Skip to content

Commit

Permalink
Merge pull request #4833 from gitbutlerapp/Fix-broken-error-page
Browse files Browse the repository at this point in the history
Fix broken error page
  • Loading branch information
krlvi authored Sep 5, 2024
2 parents 000bddb + 13be25f commit a380045
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions apps/desktop/src/routes/+error.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<script lang="ts">
import { Code, isUserErrorCode } from '$lib/backend/ipc';
import { Code } from '$lib/backend/ipc';
import ProjectNotFound from '$lib/components/ProjectNotFound.svelte';
import SomethingWentWrong from '$lib/components/SomethingWentWrong.svelte';
import { page } from '$app/stores';
$: message = $page.error
? $page.error.message
: $page.status === 404
? 'Page not found'
: 'Unknown error';
const code = $derived($page.error?.errorCode);
const status = $derived($page.status);
const message = $derived($page.error?.message);
const error = $derived(message ? message : status === 404 ? 'Page not found' : 'Unknown error');
</script>

{#if isUserErrorCode($page.error?.errorCode)}
{#if $page.error?.errorCode === Code.ProjectMissing}
<ProjectNotFound />
{/if}
{#if code === Code.ProjectMissing}
<ProjectNotFound />
{:else}
<SomethingWentWrong error={message} />
<SomethingWentWrong {error} />
{/if}

0 comments on commit a380045

Please sign in to comment.