mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-15 17:56:21 +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 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 (
|
||||
<>
|
||||
<Head>
|
||||
@@ -30,11 +36,9 @@ export const DatabaseNotWriteable = ({ error, errorMessage }: { error: any | unk
|
||||
</a>
|
||||
</List.Item>
|
||||
</List>
|
||||
<Code block>{error && JSON.stringify(error)}</Code>
|
||||
<Code block>{stringifiedError}</Code>
|
||||
|
||||
{errorMessage && (
|
||||
<Code block>{errorMessage}</Code>
|
||||
)}
|
||||
{errorMessage && <Code block>{errorMessage}</Code>}
|
||||
</Stack>
|
||||
</Center>
|
||||
</>
|
||||
|
||||
@@ -21,8 +21,8 @@ const exec = util.promisify(require('child_process').exec);
|
||||
export default function OnboardPage({
|
||||
configSchemaVersions,
|
||||
databaseNotWriteable,
|
||||
error,
|
||||
errorMessage
|
||||
stringifiedError,
|
||||
errorMessage,
|
||||
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
const { fn, colors, colorScheme } = useMantineTheme();
|
||||
const background = colorScheme === 'dark' ? 'dark.6' : 'gray.1';
|
||||
@@ -49,7 +49,7 @@ export default function OnboardPage({
|
||||
</Center>
|
||||
|
||||
{databaseNotWriteable == true ? (
|
||||
<DatabaseNotWriteable error={error} errorMessage={errorMessage} />
|
||||
<DatabaseNotWriteable stringifiedError={stringifiedError} errorMessage={errorMessage} />
|
||||
) : (
|
||||
<>
|
||||
{onboardingSteps ? (
|
||||
@@ -117,7 +117,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
...translations,
|
||||
configSchemaVersions: configSchemaVersions,
|
||||
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'");
|
||||
|
||||
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 {
|
||||
props: {
|
||||
...translations,
|
||||
configSchemaVersions: configSchemaVersions,
|
||||
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,
|
||||
configSchemaVersions: configSchemaVersions,
|
||||
databaseNotWriteable: true,
|
||||
error: error,
|
||||
errorMessage: errorMessage
|
||||
stringifiedError: JSON.stringify(error),
|
||||
errorMessage: errorMessage,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -160,7 +166,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||
props: {
|
||||
...translations,
|
||||
configSchemaVersions: configSchemaVersions,
|
||||
databaseNotWriteable: false
|
||||
databaseNotWriteable: false,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user