mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-15 09:46:19 +01:00
🐛 Error object not compatible with json parsing of gssp
This commit is contained in:
@@ -1,7 +1,13 @@
|
|||||||
import { Center, Code, List, Stack, Text, Title } from '@mantine/core';
|
import { Center, Code, List, Stack, Text, Title } from '@mantine/core';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
|
|
||||||
export const DatabaseNotWriteable = ({ error, errorMessage }: { error: any | unknown, errorMessage: string | undefined }) => {
|
export const DatabaseNotWriteable = ({
|
||||||
|
stringifiedError,
|
||||||
|
errorMessage,
|
||||||
|
}: {
|
||||||
|
stringifiedError: string | undefined;
|
||||||
|
errorMessage: string | undefined;
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
@@ -30,11 +36,9 @@ export const DatabaseNotWriteable = ({ error, errorMessage }: { error: any | unk
|
|||||||
</a>
|
</a>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
</List>
|
</List>
|
||||||
<Code block>{error && JSON.stringify(error)}</Code>
|
<Code block>{stringifiedError}</Code>
|
||||||
|
|
||||||
{errorMessage && (
|
{errorMessage && <Code block>{errorMessage}</Code>}
|
||||||
<Code block>{errorMessage}</Code>
|
|
||||||
)}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Center>
|
</Center>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ const exec = util.promisify(require('child_process').exec);
|
|||||||
export default function OnboardPage({
|
export default function OnboardPage({
|
||||||
configSchemaVersions,
|
configSchemaVersions,
|
||||||
databaseNotWriteable,
|
databaseNotWriteable,
|
||||||
error,
|
stringifiedError,
|
||||||
errorMessage
|
errorMessage,
|
||||||
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||||
const { fn, colors, colorScheme } = useMantineTheme();
|
const { fn, colors, colorScheme } = useMantineTheme();
|
||||||
const background = colorScheme === 'dark' ? 'dark.6' : 'gray.1';
|
const background = colorScheme === 'dark' ? 'dark.6' : 'gray.1';
|
||||||
@@ -49,7 +49,7 @@ export default function OnboardPage({
|
|||||||
</Center>
|
</Center>
|
||||||
|
|
||||||
{databaseNotWriteable == true ? (
|
{databaseNotWriteable == true ? (
|
||||||
<DatabaseNotWriteable error={error} errorMessage={errorMessage} />
|
<DatabaseNotWriteable stringifiedError={stringifiedError} errorMessage={errorMessage} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{onboardingSteps ? (
|
{onboardingSteps ? (
|
||||||
@@ -117,7 +117,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
...translations,
|
...translations,
|
||||||
configSchemaVersions: configSchemaVersions,
|
configSchemaVersions: configSchemaVersions,
|
||||||
databaseNotWriteable: true,
|
databaseNotWriteable: true,
|
||||||
error: error,
|
errorMessage: 'Database is not writeable',
|
||||||
|
stringifiedError: JSON.stringify(error),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -128,13 +129,18 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
const { stdout, stderr } = await exec("mount | grep '/data'");
|
const { stdout, stderr } = await exec("mount | grep '/data'");
|
||||||
|
|
||||||
if (stderr.split('\n').length > 1 || stdout.split('\n').length <= 1) {
|
if (stderr.split('\n').length > 1 || stdout.split('\n').length <= 1) {
|
||||||
Consola.error(`Database at '${rawDatabaseUrl}' has not been mounted: ${stdout.replace('\n', '\\n')} ${stderr.replace('\n', '\\n')}`);
|
Consola.error(
|
||||||
|
`Database at '${rawDatabaseUrl}' has not been mounted: ${stdout.replace(
|
||||||
|
'\n',
|
||||||
|
'\\n'
|
||||||
|
)} ${stderr.replace('\n', '\\n')}`
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
...translations,
|
...translations,
|
||||||
configSchemaVersions: configSchemaVersions,
|
configSchemaVersions: configSchemaVersions,
|
||||||
databaseNotWriteable: true,
|
databaseNotWriteable: true,
|
||||||
error: `Database at '${rawDatabaseUrl}' is not mounted:\n${stdout}`,
|
errorMessage: `Database at '${rawDatabaseUrl}' is not mounted:\n${stdout}`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -146,8 +152,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
...translations,
|
...translations,
|
||||||
configSchemaVersions: configSchemaVersions,
|
configSchemaVersions: configSchemaVersions,
|
||||||
databaseNotWriteable: true,
|
databaseNotWriteable: true,
|
||||||
error: error,
|
stringifiedError: JSON.stringify(error),
|
||||||
errorMessage: errorMessage
|
errorMessage: errorMessage,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -160,7 +166,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
props: {
|
props: {
|
||||||
...translations,
|
...translations,
|
||||||
configSchemaVersions: configSchemaVersions,
|
configSchemaVersions: configSchemaVersions,
|
||||||
databaseNotWriteable: false
|
databaseNotWriteable: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user