Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

- Rename error handler. - Truncate errors. - Better error tags, release version etc.

Andras Bacsaib4a418dded4f
diff --git a/src/lib/common.ts b/src/lib/common.ts
index b4b6966bcb..7bfa274fd1 100644
--- a/src/lib/common.ts
+++ b/src/lib/common.ts
@@ -8,16 +8,26 @@ import * as db from '$lib/database';
import { buildLogQueue } from './queues';
import { version as currentVersion } from '../../package.json';
-import { dockerInstance } from './docker';
import dayjs from 'dayjs';
import Cookie from 'cookie';
+import os from 'os';
try {
- if (!dev) {
+ if (dev) {
Sentry.init({
dsn: process.env['COOLIFY_SENTRY_DSN'],
tracesSampleRate: 0,
- environment: 'production'
+ environment: 'dev',
+ debug: true,
+ release: currentVersion,
+ initialScope: {
+ tags: {
+ appId: process.env['COOLIFY_APP_ID'],
+ 'os.arch': os.arch(),
+ 'os.platform': os.platform(),
+ 'os.release': os.release()
+ }
+ }
});
}
} catch (err) {
diff --git a/src/lib/database/applications.ts b/src/lib/database/applications.ts
index e96d41e639..d7d2a5d8a6 100644
--- a/src/lib/database/applications.ts
+++ b/src/lib/database/applications.ts
@@ -113,6 +113,13 @@ export async function getApplicationWebhook({ projectId, branch }) {
throw { status: 404, body: { message: e.message } };
}
}
+export async function getApplicationById({ id }) {
+ const body = await prisma.application.findFirst({
+ where: { id }
+ });
+
+ return { ...body };
+}
export async function getApplication({ id, teamId }) {
let body = await prisma.application.findFirst({
where: { id, teams: { some: { id: teamId } } },
diff --git a/src/lib/database/common.ts b/src/lib/database/common.ts
index c94dadd28b..d020a05ca1 100644
--- a/src/lib/database/common.ts
+++ b/src/lib/database/common.ts
@@ -36,23 +36,34 @@ if (dev) {
}
export const prisma = new PrismaClient(prismaOptions);
-export function PrismaErrorHandler(e) {
+export function ErrorHandler(e) {
if (e! instanceof Error) {
e = new Error(e.toString());
}
- sentry.captureException(e);
+ let truncatedError = e;
+ if (e.message.includes('docker run')) {
+ let truncatedArray = [];
+ truncatedArray = truncatedError.message.split('-').filter((line) => {
+ if (!line.startsWith('e ')) {
+ return line;
+ }
+ });
+
+ truncatedError.message = truncatedArray.join('-');
+ }
+ sentry.captureException(truncatedError);
const payload = {
- status: e.status || 500,
+ status: truncatedError.status || 500,
body: {
message: 'Ooops, something is not okay, are you okay?',
- error: e.error || e.message
+ error: truncatedError.error || truncatedError.message
}
};
- if (e.name === 'NotFoundError') {
+ if (truncatedError.name === 'NotFoundError') {
payload.status = 404;
}
- if (e instanceof P.PrismaClientKnownRequestError) {
- if (e.code === 'P2002') {
+ if (truncatedError instanceof P.PrismaClientKnownRequestError) {
+ if (truncatedError.code === 'P2002') {
payload.body.message = 'Already exists. Choose another name.';
}
}
diff --git a/src/lib/database/databases.ts b/src/lib/database/databases.ts
index 6ca187ffb1..b38c388828 100644
--- a/src/lib/database/databases.ts
+++ b/src/lib/database/databases.ts
@@ -2,7 +2,7 @@ import { decrypt, encrypt } from '$lib/crypto';
import { dockerInstance } from '$lib/docker';
import cuid from 'cuid';
import { generatePassword } from '.';
-import { prisma, PrismaErrorHandler } from './common';
+import { prisma, ErrorHandler } from './common';
import getPort from 'get-port';
import { asyncExecShell, getEngine, removeContainer } from '$lib/common';
diff --git a/src/lib/database/logs.ts b/src/lib/database/logs.ts
index 0b92654b78..9a71f51e4c 100644
--- a/src/lib/database/logs.ts
+++ b/src/lib/database/logs.ts
@@ -1,4 +1,4 @@
-import { prisma, PrismaErrorHandler } from './common';
+import { prisma, ErrorHandler } from './common';
export async function listLogs({ buildId, last = 0 }) {
try {
@@ -8,6 +8,6 @@ export async function listLogs({ buildId, last = 0 }) {
});
return [...body];
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
}
diff --git a/src/lib/haproxy/index.ts b/src/lib/haproxy/index.ts
index 56b7ce789a..0a6bbaa220 100644
--- a/src/lib/haproxy/index.ts
+++ b/src/lib/haproxy/index.ts
@@ -460,7 +460,7 @@ export async function startCoolifyProxy(engine) {
);
const ip = JSON.parse(Config)[0].Gateway;
await asyncExecShell(
- `DOCKER_HOST="${host}" docker run -e HAPROXY_USERNAME=${proxyUser} -e HAPROXY_PASSWORD=${proxyPassword} --restart always --add-host 'host.docker.internal:host-gateway' --add-host 'host.docker.internal:${ip}' -v coolify-ssl-certs:/usr/local/etc/haproxy/ssl --network coolify-infra -p "80:80" -p "443:443" -p "8404:8404" -p "5555:5555" -p "5000:5000" --name coolify-haproxy -d coollabsio/${defaultProxyImage}`
+ `DOCKER_HOST="${host}" docker run -e HAPROXY_USERNAME=${proxyUser} -e HAPROXY_PASSWORD=${proxyPassword} --restarts always --add-host 'host.docker.internal:host-gateway' --add-host 'host.docker.internal:${ip}' -v coolify-ssl-certs:/usr/local/etc/haproxy/ssl --network coolify-infra -p "80:80" -p "443:443" -p "8404:8404" -p "5555:5555" -p "5000:5000" --name coolify-haproxy -d coollabsio/${defaultProxyImage}`
);
}
await configureNetworkCoolifyProxy(engine);
diff --git a/src/lib/importers/github.ts b/src/lib/importers/github.ts
index e8c4bb79cd..418fe596a9 100644
--- a/src/lib/importers/github.ts
+++ b/src/lib/importers/github.ts
@@ -2,7 +2,7 @@ import { asyncExecShell, saveBuildLog } from '$lib/common';
import got from 'got';
import jsonwebtoken from 'jsonwebtoken';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export default async function ({
applicationId,
@@ -45,6 +45,6 @@ export default async function ({
const { stdout: commit } = await asyncExecShell(`cd ${workdir}/ && git rev-parse HEAD`);
return commit.replace('\n', '');
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
}
diff --git a/src/lib/importers/gitlab.ts b/src/lib/importers/gitlab.ts
index 918bf24027..fceda7fe71 100644
--- a/src/lib/importers/gitlab.ts
+++ b/src/lib/importers/gitlab.ts
@@ -1,5 +1,5 @@
import { asyncExecShell, saveBuildLog } from '$lib/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export default async function ({
applicationId,
diff --git a/src/lib/letsencrypt.ts b/src/lib/letsencrypt.ts
index 9b92cbdcf9..86d9e6e25d 100644
--- a/src/lib/letsencrypt.ts
+++ b/src/lib/letsencrypt.ts
@@ -2,15 +2,17 @@ import { dev } from '$app/env';
import { forceSSLOffApplication, forceSSLOnApplication, getNextTransactionId } from '$lib/haproxy';
import { asyncExecShell, getEngine } from './common';
import * as db from '$lib/database';
+import cuid from 'cuid';
export async function letsEncrypt({ domain, isCoolify = false, id = null }) {
try {
+ const randomCuid = cuid();
if (dev) {
return await forceSSLOnApplication({ domain });
} else {
if (isCoolify) {
await asyncExecShell(
- `docker run --rm --name certbot -p 9080:9080 -v "coolify-letsencrypt:/etc/letsencrypt" certbot/certbot --logs-dir /etc/letsencrypt/logs certonly --standalone --preferred-challenges http --http-01-address 0.0.0.0 --http-01-port 9080 -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`
+ `docker run --rm --name certbot-${randomCuid} -p 9080:9080 -v "coolify-letsencrypt:/etc/letsencrypt" certbot/certbot --logs-dir /etc/letsencrypt/logs certonly --standalone --preferred-challenges http --http-01-address 0.0.0.0 --http-01-port 9080 -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`
);
const { stderr } = await asyncExecShell(
@@ -33,10 +35,10 @@ export async function letsEncrypt({ domain, isCoolify = false, id = null }) {
if (data.destinationDockerId && data.destinationDocker) {
const host = getEngine(data.destinationDocker.engine);
await asyncExecShell(
- `DOCKER_HOST=${host} docker run --rm --name certbot -p 9080:9080 -v "coolify-letsencrypt:/etc/letsencrypt" certbot/certbot --logs-dir /etc/letsencrypt/logs certonly --standalone --preferred-challenges http --http-01-address 0.0.0.0 --http-01-port 9080 -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`
+ `DOCKER_HOST=${host} docker run --rm --name certbot-${randomCuid} -p 9080:9080 -v "coolify-letsencrypt:/etc/letsencrypt" certbot/certbot --logs-dir /etc/letsencrypt/logs certonly --standalone --preferred-challenges http --http-01-address 0.0.0.0 --http-01-port 9080 -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`
);
const { stderr } = await asyncExecShell(
- `DOCKER_HOST=${host} docker run --rm --name bash -v "coolify-letsencrypt:/etc/letsencrypt" -v "coolify-ssl-certs:/app/ssl" alpine:latest cat /etc/letsencrypt/live/${domain}/fullchain.pem /etc/letsencrypt/live/${domain}/privkey.pem > /app/ssl/${domain}.pem`
+ `DOCKER_HOST=${host} docker run --rm --name bash-${randomCuid} -v "coolify-letsencrypt:/etc/letsencrypt" -v "coolify-ssl-certs:/app/ssl" alpine:latest cat /etc/letsencrypt/live/${domain}/fullchain.pem /etc/letsencrypt/live/${domain}/privkey.pem > /app/ssl/${domain}.pem`
);
if (stderr) throw new Error(stderr);
await forceSSLOnApplication({ domain });
diff --git a/src/lib/queues/proxy.ts b/src/lib/queues/proxy.ts
index 1e1b9c2f3c..9ef0e85f9d 100644
--- a/src/lib/queues/proxy.ts
+++ b/src/lib/queues/proxy.ts
@@ -1,5 +1,5 @@
import { getDomain } from '$lib/common';
-import { prisma } from '$lib/database';
+import { getApplicationById, prisma } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import {
checkContainer,
@@ -30,18 +30,21 @@ export default async function () {
if (configuration.Labels['coolify.type'] === 'standalone-application') {
const { fqdn, applicationId, port, pullmergeRequestId } = parsedConfiguration;
if (fqdn) {
- const domain = getDomain(fqdn);
- await configureProxyForApplication({
- domain,
- imageId: pullmergeRequestId
- ? `${applicationId}-${pullmergeRequestId}`
- : applicationId,
- applicationId,
- port
- });
- const isHttps = fqdn.startsWith('https://');
- if (isHttps) await forceSSLOnApplication({ domain });
- await setWwwRedirection(fqdn);
+ const found = await getApplicationById({ id: applicationId });
+ if (found) {
+ const domain = getDomain(fqdn);
+ await configureProxyForApplication({
+ domain,
+ imageId: pullmergeRequestId
+ ? `${applicationId}-${pullmergeRequestId}`
+ : applicationId,
+ applicationId,
+ port
+ });
+ const isHttps = fqdn.startsWith('https://');
+ if (isHttps) await forceSSLOnApplication({ domain });
+ await setWwwRedirection(fqdn);
+ }
}
}
}
diff --git a/src/routes/applications/[id]/check.json.ts b/src/routes/applications/[id]/check.json.ts
index d8ed3fa093..267f7c3840 100644
--- a/src/routes/applications/[id]/check.json.ts
+++ b/src/routes/applications/[id]/check.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, getDomain, getEngine, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -23,6 +23,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/configuration/buildpack.json.ts b/src/routes/applications/[id]/configuration/buildpack.json.ts
index 0e798e600d..3f1374f170 100644
--- a/src/routes/applications/[id]/configuration/buildpack.json.ts
+++ b/src/routes/applications/[id]/configuration/buildpack.json.ts
@@ -1,7 +1,7 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export const get: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -21,7 +21,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -36,6 +36,6 @@ export const post: RequestHandler = async (event) => {
await db.configureBuildPack({ id, buildPack });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/configuration/deploykey.json.ts b/src/routes/applications/[id]/configuration/deploykey.json.ts
index a0a69915ae..7599d15cbd 100644
--- a/src/routes/applications/[id]/configuration/deploykey.json.ts
+++ b/src/routes/applications/[id]/configuration/deploykey.json.ts
@@ -1,5 +1,5 @@
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -12,6 +12,6 @@ export const post: RequestHandler = async (event) => {
await db.updateDeployKey({ id, deployKeyId });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/configuration/destination.json.ts b/src/routes/applications/[id]/configuration/destination.json.ts
index ef73883db1..48989917e6 100644
--- a/src/routes/applications/[id]/configuration/destination.json.ts
+++ b/src/routes/applications/[id]/configuration/destination.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -14,6 +14,6 @@ export const post: RequestHandler = async (event) => {
await db.configureDestinationForApplication({ id, destinationId });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/configuration/repository.json.ts b/src/routes/applications/[id]/configuration/repository.json.ts
index 8e1c3aa167..c462fa5a4b 100644
--- a/src/routes/applications/[id]/configuration/repository.json.ts
+++ b/src/routes/applications/[id]/configuration/repository.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -23,7 +23,7 @@ export const get: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -42,6 +42,6 @@ export const post: RequestHandler = async (event) => {
await db.configureGitRepository({ id, repository, branch, projectId, webhookToken });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/configuration/source.json.ts b/src/routes/applications/[id]/configuration/source.json.ts
index 089dc3063a..6481cc5334 100644
--- a/src/routes/applications/[id]/configuration/source.json.ts
+++ b/src/routes/applications/[id]/configuration/source.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -13,6 +13,6 @@ export const post: RequestHandler = async (event) => {
await db.configureGitsource({ id, gitSourceId });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/configuration/sshkey.json.ts b/src/routes/applications/[id]/configuration/sshkey.json.ts
index 4514634f54..38b1640882 100644
--- a/src/routes/applications/[id]/configuration/sshkey.json.ts
+++ b/src/routes/applications/[id]/configuration/sshkey.json.ts
@@ -1,5 +1,5 @@
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -7,7 +7,7 @@ export const get: RequestHandler = async (event) => {
try {
return await db.getSshKey({ id });
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
export const post: RequestHandler = async (event) => {
@@ -15,6 +15,6 @@ export const post: RequestHandler = async (event) => {
try {
return await db.generateSshKey({ id });
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/delete.json.ts b/src/routes/applications/[id]/delete.json.ts
index 1f3730fc5a..b451728df4 100644
--- a/src/routes/applications/[id]/delete.json.ts
+++ b/src/routes/applications/[id]/delete.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const del: RequestHandler = async (event) => {
@@ -14,6 +14,6 @@ export const del: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/deploy.json.ts b/src/routes/applications/[id]/deploy.json.ts
index b6b1a0a953..059401ba14 100644
--- a/src/routes/applications/[id]/deploy.json.ts
+++ b/src/routes/applications/[id]/deploy.json.ts
@@ -4,7 +4,7 @@ import cuid from 'cuid';
import crypto from 'crypto';
import { buildQueue } from '$lib/queues';
import { getUserDetails } from '$lib/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -37,6 +37,6 @@ export const post: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/index.json.ts b/src/routes/applications/[id]/index.json.ts
index eedd89d9f9..88d8b30a86 100644
--- a/src/routes/applications/[id]/index.json.ts
+++ b/src/routes/applications/[id]/index.json.ts
@@ -1,7 +1,7 @@
import { getTeam, getUserDetails } from '$lib/common';
import { getGithubToken } from '$lib/components/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { checkContainer } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
import jsonwebtoken from 'jsonwebtoken';
@@ -44,7 +44,7 @@ export const get: RequestHandler = async (event) => {
};
} catch (error) {
console.log(error);
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -82,6 +82,6 @@ export const post: RequestHandler = async (event) => {
});
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/logs/build/build.json.ts b/src/routes/applications/[id]/logs/build/build.json.ts
index da6956939c..d6b79ceebe 100644
--- a/src/routes/applications/[id]/logs/build/build.json.ts
+++ b/src/routes/applications/[id]/logs/build/build.json.ts
@@ -1,6 +1,6 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -23,6 +23,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/logs/build/index.json.ts b/src/routes/applications/[id]/logs/build/index.json.ts
index ce58e357b4..1af90f289e 100644
--- a/src/routes/applications/[id]/logs/build/index.json.ts
+++ b/src/routes/applications/[id]/logs/build/index.json.ts
@@ -1,5 +1,5 @@
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dayjs } from '$lib/dayjs';
import type { RequestHandler } from '@sveltejs/kit';
@@ -35,6 +35,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/logs/index.json.ts b/src/routes/applications/[id]/logs/index.json.ts
index 0ea806fb47..f3ab6b9ca5 100644
--- a/src/routes/applications/[id]/logs/index.json.ts
+++ b/src/routes/applications/[id]/logs/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dayjs } from '$lib/dayjs';
import { dockerInstance } from '$lib/docker';
import type { RequestHandler } from '@sveltejs/kit';
@@ -48,6 +48,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/previews/index.json.ts b/src/routes/applications/[id]/previews/index.json.ts
index 29ffafdeb0..fd5bd45b0a 100644
--- a/src/routes/applications/[id]/previews/index.json.ts
+++ b/src/routes/applications/[id]/previews/index.json.ts
@@ -1,6 +1,6 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import type { RequestHandler } from '@sveltejs/kit';
import jsonwebtoken from 'jsonwebtoken';
@@ -39,6 +39,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/secrets/index.json.ts b/src/routes/applications/[id]/secrets/index.json.ts
index 5308427be2..bed54b950d 100644
--- a/src/routes/applications/[id]/secrets/index.json.ts
+++ b/src/routes/applications/[id]/secrets/index.json.ts
@@ -1,6 +1,6 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -18,7 +18,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -42,7 +42,7 @@ export const post: RequestHandler = async (event) => {
};
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
export const del: RequestHandler = async (event) => {
@@ -58,6 +58,6 @@ export const del: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/settings.json.ts b/src/routes/applications/[id]/settings.json.ts
index 100b2a7ff4..ddd7bb5ca3 100644
--- a/src/routes/applications/[id]/settings.json.ts
+++ b/src/routes/applications/[id]/settings.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -14,6 +14,6 @@ export const post: RequestHandler = async (event) => {
await db.setApplicationSettings({ id, debug, previews });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/[id]/stop.json.ts b/src/routes/applications/[id]/stop.json.ts
index 041dc5296b..1148e3b653 100644
--- a/src/routes/applications/[id]/stop.json.ts
+++ b/src/routes/applications/[id]/stop.json.ts
@@ -1,6 +1,6 @@
import { getDomain, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import { removeProxyConfiguration } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -26,6 +26,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/index.json.ts b/src/routes/applications/index.json.ts
index a7f067082e..640577e164 100644
--- a/src/routes/applications/index.json.ts
+++ b/src/routes/applications/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -16,6 +16,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/configuration/destination.json.ts b/src/routes/databases/[id]/configuration/destination.json.ts
index 24373beed5..ae7cf2fce5 100644
--- a/src/routes/databases/[id]/configuration/destination.json.ts
+++ b/src/routes/databases/[id]/configuration/destination.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -14,6 +14,6 @@ export const post: RequestHandler = async (event) => {
await db.configureDestinationForDatabase({ id, destinationId });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/configuration/type.json.ts b/src/routes/databases/[id]/configuration/type.json.ts
index 63685a9c5b..6f797e4156 100644
--- a/src/routes/databases/[id]/configuration/type.json.ts
+++ b/src/routes/databases/[id]/configuration/type.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler, supportedDatabaseTypesAndVersions } from '$lib/database';
+import { ErrorHandler, supportedDatabaseTypesAndVersions } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -27,6 +27,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/configuration/version.json.ts b/src/routes/databases/[id]/configuration/version.json.ts
index 37d82fcafe..3477d832d3 100644
--- a/src/routes/databases/[id]/configuration/version.json.ts
+++ b/src/routes/databases/[id]/configuration/version.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler, supportedDatabaseTypesAndVersions } from '$lib/database';
+import { ErrorHandler, supportedDatabaseTypesAndVersions } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -31,6 +31,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/delete.json.ts b/src/routes/databases/[id]/delete.json.ts
index 7cbd5b756d..c819165049 100644
--- a/src/routes/databases/[id]/delete.json.ts
+++ b/src/routes/databases/[id]/delete.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler, stopDatabase } from '$lib/database';
+import { ErrorHandler, stopDatabase } from '$lib/database';
import { deleteProxy } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -17,6 +17,6 @@ export const del: RequestHandler = async (event) => {
await db.removeDatabase({ id });
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/index.json.ts b/src/routes/databases/[id]/index.json.ts
index c9867c94f9..3fce434822 100644
--- a/src/routes/databases/[id]/index.json.ts
+++ b/src/routes/databases/[id]/index.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, getEngine, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { generateDatabaseConfiguration, getVersions, PrismaErrorHandler } from '$lib/database';
+import { generateDatabaseConfiguration, getVersions, ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -40,7 +40,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -64,6 +64,6 @@ export const post: RequestHandler = async (event) => {
});
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/settings.json.ts b/src/routes/databases/[id]/settings.json.ts
index bda37c8db3..350ce68917 100644
--- a/src/routes/databases/[id]/settings.json.ts
+++ b/src/routes/databases/[id]/settings.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { generateDatabaseConfiguration, PrismaErrorHandler } from '$lib/database';
+import { generateDatabaseConfiguration, ErrorHandler } from '$lib/database';
import { startTcpProxy, stopTcpHttpProxy } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -29,6 +29,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/start.json.ts b/src/routes/databases/[id]/start.json.ts
index 30c18f66f8..bca2995d49 100644
--- a/src/routes/databases/[id]/start.json.ts
+++ b/src/routes/databases/[id]/start.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, createDirectories, getEngine, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { generateDatabaseConfiguration, PrismaErrorHandler } from '$lib/database';
+import { generateDatabaseConfiguration, ErrorHandler } from '$lib/database';
import { promises as fs } from 'fs';
import yaml from 'js-yaml';
import type { RequestHandler } from '@sveltejs/kit';
@@ -77,6 +77,6 @@ export const post: RequestHandler = async (event) => {
};
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/[id]/stop.json.ts b/src/routes/databases/[id]/stop.json.ts
index 42b9644038..c099276584 100644
--- a/src/routes/databases/[id]/stop.json.ts
+++ b/src/routes/databases/[id]/stop.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler, stopDatabase } from '$lib/database';
+import { ErrorHandler, stopDatabase } from '$lib/database';
import { stopTcpHttpProxy } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -20,6 +20,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/databases/index.json.ts b/src/routes/databases/index.json.ts
index ae9b059e82..17ff3c7792 100644
--- a/src/routes/databases/index.json.ts
+++ b/src/routes/databases/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -15,6 +15,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/destinations/[id]/index.json.ts b/src/routes/destinations/[id]/index.json.ts
index e6fc9d075f..9d8804a671 100644
--- a/src/routes/destinations/[id]/index.json.ts
+++ b/src/routes/destinations/[id]/index.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, getEngine, getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { checkContainer } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -23,7 +23,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
export const post: RequestHandler = async (event) => {
@@ -37,7 +37,7 @@ export const post: RequestHandler = async (event) => {
await db.updateDestination({ id, name, engine, network });
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -51,6 +51,6 @@ export const del: RequestHandler = async (event) => {
await db.removeDestination({ id });
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/destinations/[id]/scan.json.ts b/src/routes/destinations/[id]/scan.json.ts
index ab02cd2e6a..400c2c7e2d 100644
--- a/src/routes/destinations/[id]/scan.json.ts
+++ b/src/routes/destinations/[id]/scan.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import type { RequestHandler } from '@sveltejs/kit';
@@ -59,6 +59,6 @@ export const post: RequestHandler = async (event) => {
status: 404
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/destinations/[id]/settings.json.ts b/src/routes/destinations/[id]/settings.json.ts
index 952acf92f2..84a5be120a 100644
--- a/src/routes/destinations/[id]/settings.json.ts
+++ b/src/routes/destinations/[id]/settings.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -13,6 +13,6 @@ export const post: RequestHandler = async (event) => {
await db.setDestinationSettings({ engine, isCoolifyProxyUsed });
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/destinations/[id]/start.json.ts b/src/routes/destinations/[id]/start.json.ts
index b0d943bf9c..0d52bdb340 100644
--- a/src/routes/destinations/[id]/start.json.ts
+++ b/src/routes/destinations/[id]/start.json.ts
@@ -1,5 +1,5 @@
import { getUserDetails } from '$lib/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { startCoolifyProxy, stopCoolifyProxy } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -15,7 +15,8 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
+ return ErrorHandler(error);
+ } finally {
await stopCoolifyProxy(engine);
- return PrismaErrorHandler(error);
}
};
diff --git a/src/routes/destinations/[id]/stop.json.ts b/src/routes/destinations/[id]/stop.json.ts
index 9735e2c64a..495c7612e0 100644
--- a/src/routes/destinations/[id]/stop.json.ts
+++ b/src/routes/destinations/[id]/stop.json.ts
@@ -1,5 +1,5 @@
import { getUserDetails } from '$lib/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { stopCoolifyProxy } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -14,6 +14,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/destinations/index.json.ts b/src/routes/destinations/index.json.ts
index 881dc29dd2..0d8d3d0bc6 100644
--- a/src/routes/destinations/index.json.ts
+++ b/src/routes/destinations/index.json.ts
@@ -1,6 +1,6 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (request) => {
@@ -14,6 +14,6 @@ export const get: RequestHandler = async (request) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/index.json.ts b/src/routes/index.json.ts
index 562c1186f1..226a76a378 100644
--- a/src/routes/index.json.ts
+++ b/src/routes/index.json.ts
@@ -1,6 +1,6 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -25,7 +25,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/login/index.json.ts b/src/routes/login/index.json.ts
index 26c912a932..ded546538d 100644
--- a/src/routes/login/index.json.ts
+++ b/src/routes/login/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -13,7 +13,7 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -28,6 +28,6 @@ export const get: RequestHandler = async (event) => {
await db.getUser({ userId });
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/new/application/import.json.ts b/src/routes/new/application/import.json.ts
index 4bfe22268b..495bc3dcfc 100644
--- a/src/routes/new/application/import.json.ts
+++ b/src/routes/new/application/import.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -24,6 +24,6 @@ export const post: RequestHandler = async (event) => {
});
return { status: 201, body: { id } };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/new/application/index.json.ts b/src/routes/new/application/index.json.ts
index 0d685af218..b8d25fc637 100644
--- a/src/routes/new/application/index.json.ts
+++ b/src/routes/new/application/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails, uniqueName } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -14,6 +14,6 @@ export const post: RequestHandler = async (event) => {
const { id } = await db.newApplication({ name, teamId });
return { status: 201, body: { id } };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/new/database/index.json.ts b/src/routes/new/database/index.json.ts
index e6b46ad42f..a774aff84b 100644
--- a/src/routes/new/database/index.json.ts
+++ b/src/routes/new/database/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -13,6 +13,6 @@ export const post: RequestHandler = async (event) => {
const { id } = await db.newDatabase({ name, teamId });
return { status: 201, body: { id } };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/new/destination/check.json.ts b/src/routes/new/destination/check.json.ts
index bb8f8f50f0..22af08e91c 100644
--- a/src/routes/new/destination/check.json.ts
+++ b/src/routes/new/destination/check.json.ts
@@ -1,5 +1,5 @@
import { getUserDetails } from '$lib/common';
-import { isDockerNetworkExists, PrismaErrorHandler } from '$lib/database';
+import { isDockerNetworkExists, ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -18,6 +18,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/new/destination/docker.json.ts b/src/routes/new/destination/docker.json.ts
index aaef77bf9e..93aa9bf015 100644
--- a/src/routes/new/destination/docker.json.ts
+++ b/src/routes/new/destination/docker.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import type { RequestHandler } from '@sveltejs/kit';
@@ -14,6 +14,6 @@ export const post: RequestHandler = async (event) => {
const id = await db.newDestination({ name, teamId, engine, network, isCoolifyProxyUsed });
return { status: 200, body: { id } };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/new/service/index.json.ts b/src/routes/new/service/index.json.ts
index 4a42c65dc9..3594f7920c 100644
--- a/src/routes/new/service/index.json.ts
+++ b/src/routes/new/service/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails, uniqueName } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -13,6 +13,6 @@ export const post: RequestHandler = async (event) => {
const { id } = await db.newService({ name, teamId });
return { status: 201, body: { id } };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/new/source/index.json.ts b/src/routes/new/source/index.json.ts
index 3debc81d6f..803b597e96 100644
--- a/src/routes/new/source/index.json.ts
+++ b/src/routes/new/source/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -12,6 +12,6 @@ export const post: RequestHandler = async (event) => {
const { id } = await db.newSource({ name, teamId, type, htmlUrl, apiUrl, organization });
return { status: 201, body: { id } };
} catch (e) {
- return PrismaErrorHandler(e);
+ return ErrorHandler(e);
}
};
diff --git a/src/routes/new/team/index.json.ts b/src/routes/new/team/index.json.ts
index e8eae866d5..7873e56f1a 100644
--- a/src/routes/new/team/index.json.ts
+++ b/src/routes/new/team/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails, uniqueName } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -13,6 +13,6 @@ export const post: RequestHandler = async (event) => {
const { id } = await db.newTeam({ name, userId });
return { status: 201, body: { id } };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/check.json.ts b/src/routes/services/[id]/check.json.ts
index 6aff4c7a20..5fb1915a06 100644
--- a/src/routes/services/[id]/check.json.ts
+++ b/src/routes/services/[id]/check.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, getDomain, getEngine, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -21,6 +21,6 @@ export const post: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/configuration/destination.json.ts b/src/routes/services/[id]/configuration/destination.json.ts
index 7a2556b4b5..d684147d96 100644
--- a/src/routes/services/[id]/configuration/destination.json.ts
+++ b/src/routes/services/[id]/configuration/destination.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -14,6 +14,6 @@ export const post: RequestHandler = async (event) => {
await db.configureDestinationForService({ id, destinationId });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/configuration/type.json.ts b/src/routes/services/[id]/configuration/type.json.ts
index 02595a0c22..daf1cc71a4 100644
--- a/src/routes/services/[id]/configuration/type.json.ts
+++ b/src/routes/services/[id]/configuration/type.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler, supportedServiceTypesAndVersions } from '$lib/database';
+import { ErrorHandler, supportedServiceTypesAndVersions } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -27,6 +27,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/configuration/version.json.ts b/src/routes/services/[id]/configuration/version.json.ts
index e1e68e69b2..57d86fed2e 100644
--- a/src/routes/services/[id]/configuration/version.json.ts
+++ b/src/routes/services/[id]/configuration/version.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler, supportedServiceTypesAndVersions } from '$lib/database';
+import { ErrorHandler, supportedServiceTypesAndVersions } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -18,7 +18,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -35,6 +35,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/delete.json.ts b/src/routes/services/[id]/delete.json.ts
index 6608827473..63da062240 100644
--- a/src/routes/services/[id]/delete.json.ts
+++ b/src/routes/services/[id]/delete.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const del: RequestHandler = async (events) => {
@@ -13,6 +13,6 @@ export const del: RequestHandler = async (events) => {
await db.removeService({ id });
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/index.json.ts b/src/routes/services/[id]/index.json.ts
index 58f9beaef6..d712c1c72f 100644
--- a/src/routes/services/[id]/index.json.ts
+++ b/src/routes/services/[id]/index.json.ts
@@ -4,7 +4,7 @@ import {
generateDatabaseConfiguration,
getServiceImage,
getVersions,
- PrismaErrorHandler
+ ErrorHandler
} from '$lib/database';
import { dockerInstance } from '$lib/docker';
import type { RequestHandler } from '@sveltejs/kit';
@@ -43,6 +43,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/minio/index.json.ts b/src/routes/services/[id]/minio/index.json.ts
index d025604b58..be5c0525fa 100644
--- a/src/routes/services/[id]/minio/index.json.ts
+++ b/src/routes/services/[id]/minio/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -16,6 +16,6 @@ export const post: RequestHandler = async (event) => {
await db.updateNocoDbOrMinioService({ id, fqdn, name });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/minio/start.json.ts b/src/routes/services/[id]/minio/start.json.ts
index dbdf65613d..2a939b8019 100644
--- a/src/routes/services/[id]/minio/start.json.ts
+++ b/src/routes/services/[id]/minio/start.json.ts
@@ -13,7 +13,7 @@ import {
} from '$lib/haproxy';
import getPort from 'get-port';
import { getDomain } from '$lib/components/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -100,9 +100,9 @@ export const post: RequestHandler = async (event) => {
};
} catch (error) {
console.log(error);
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/minio/stop.json.ts b/src/routes/services/[id]/minio/stop.json.ts
index 94e4f4be62..38398d202d 100644
--- a/src/routes/services/[id]/minio/stop.json.ts
+++ b/src/routes/services/[id]/minio/stop.json.ts
@@ -1,7 +1,7 @@
import { getEngine, getUserDetails, removeDestinationDocker } from '$lib/common';
import { getDomain } from '$lib/components/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import { checkContainer, configureSimpleServiceProxyOff, stopTcpHttpProxy } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -41,6 +41,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/nocodb/index.json.ts b/src/routes/services/[id]/nocodb/index.json.ts
index 920ab24d89..bc9f1a0d12 100644
--- a/src/routes/services/[id]/nocodb/index.json.ts
+++ b/src/routes/services/[id]/nocodb/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -15,6 +15,6 @@ export const post: RequestHandler = async (event) => {
await db.updateNocoDbOrMinioService({ id, fqdn, name });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/nocodb/start.json.ts b/src/routes/services/[id]/nocodb/start.json.ts
index b0e29457ca..43022209e5 100644
--- a/src/routes/services/[id]/nocodb/start.json.ts
+++ b/src/routes/services/[id]/nocodb/start.json.ts
@@ -6,7 +6,7 @@ import type { RequestHandler } from '@sveltejs/kit';
import { letsEncrypt } from '$lib/letsencrypt';
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
import { getDomain } from '$lib/components/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -59,9 +59,9 @@ export const post: RequestHandler = async (event) => {
};
} catch (error) {
console.log(error);
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/nocodb/stop.json.ts b/src/routes/services/[id]/nocodb/stop.json.ts
index 64a3141b38..8874df9a56 100644
--- a/src/routes/services/[id]/nocodb/stop.json.ts
+++ b/src/routes/services/[id]/nocodb/stop.json.ts
@@ -1,7 +1,7 @@
import { getUserDetails, removeDestinationDocker } from '$lib/common';
import { getDomain } from '$lib/components/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import { checkContainer, configureSimpleServiceProxyOff } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -34,6 +34,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/plausibleanalytics/activate.json.ts b/src/routes/services/[id]/plausibleanalytics/activate.json.ts
index 2200fff3d1..d6528d74b5 100644
--- a/src/routes/services/[id]/plausibleanalytics/activate.json.ts
+++ b/src/routes/services/[id]/plausibleanalytics/activate.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import type { RequestHandler } from '@sveltejs/kit';
@@ -28,6 +28,6 @@ export const post: RequestHandler = async (event) => {
}
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/plausibleanalytics/index.json.ts b/src/routes/services/[id]/plausibleanalytics/index.json.ts
index cd149685c6..519b582a28 100644
--- a/src/routes/services/[id]/plausibleanalytics/index.json.ts
+++ b/src/routes/services/[id]/plausibleanalytics/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -21,6 +21,6 @@ export const post: RequestHandler = async (event) => {
await db.updatePlausibleAnalyticsService({ id, fqdn, name, email, username });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/plausibleanalytics/start.json.ts b/src/routes/services/[id]/plausibleanalytics/start.json.ts
index 9314f9c01d..2f1ce9fd04 100644
--- a/src/routes/services/[id]/plausibleanalytics/start.json.ts
+++ b/src/routes/services/[id]/plausibleanalytics/start.json.ts
@@ -6,7 +6,7 @@ import type { RequestHandler } from '@sveltejs/kit';
import { letsEncrypt } from '$lib/letsencrypt';
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
import { getDomain } from '$lib/components/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -191,6 +191,6 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`;
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/plausibleanalytics/stop.json.ts b/src/routes/services/[id]/plausibleanalytics/stop.json.ts
index 1c7fc95157..06dc064711 100644
--- a/src/routes/services/[id]/plausibleanalytics/stop.json.ts
+++ b/src/routes/services/[id]/plausibleanalytics/stop.json.ts
@@ -1,7 +1,7 @@
import { getUserDetails, removeDestinationDocker } from '$lib/common';
import { getDomain } from '$lib/components/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import { checkContainer, configureSimpleServiceProxyOff } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -44,6 +44,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/vaultwarden/index.json.ts b/src/routes/services/[id]/vaultwarden/index.json.ts
index 49d89b2079..08d80a5478 100644
--- a/src/routes/services/[id]/vaultwarden/index.json.ts
+++ b/src/routes/services/[id]/vaultwarden/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -15,6 +15,6 @@ export const post: RequestHandler = async (event) => {
await db.updateVaultWardenService({ id, fqdn, name });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/vaultwarden/start.json.ts b/src/routes/services/[id]/vaultwarden/start.json.ts
index f219acfb2b..fac46dc1c1 100644
--- a/src/routes/services/[id]/vaultwarden/start.json.ts
+++ b/src/routes/services/[id]/vaultwarden/start.json.ts
@@ -6,7 +6,7 @@ import type { RequestHandler } from '@sveltejs/kit';
import { letsEncrypt } from '$lib/letsencrypt';
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
import { getDomain } from '$lib/components/common';
-import { getServiceImage, PrismaErrorHandler } from '$lib/database';
+import { getServiceImage, ErrorHandler } from '$lib/database';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -76,9 +76,9 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/vaultwarden/stop.json.ts b/src/routes/services/[id]/vaultwarden/stop.json.ts
index 64a3141b38..8874df9a56 100644
--- a/src/routes/services/[id]/vaultwarden/stop.json.ts
+++ b/src/routes/services/[id]/vaultwarden/stop.json.ts
@@ -1,7 +1,7 @@
import { getUserDetails, removeDestinationDocker } from '$lib/common';
import { getDomain } from '$lib/components/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import { checkContainer, configureSimpleServiceProxyOff } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -34,6 +34,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/vscodeserver/index.json.ts b/src/routes/services/[id]/vscodeserver/index.json.ts
index 6824a31dd4..d1ec862bce 100644
--- a/src/routes/services/[id]/vscodeserver/index.json.ts
+++ b/src/routes/services/[id]/vscodeserver/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -16,6 +16,6 @@ export const post: RequestHandler = async (event) => {
await db.updateVsCodeServer({ id, fqdn, name });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/vscodeserver/start.json.ts b/src/routes/services/[id]/vscodeserver/start.json.ts
index 8b58c575b1..4a5ea2c226 100644
--- a/src/routes/services/[id]/vscodeserver/start.json.ts
+++ b/src/routes/services/[id]/vscodeserver/start.json.ts
@@ -6,7 +6,7 @@ import type { RequestHandler } from '@sveltejs/kit';
import { letsEncrypt } from '$lib/letsencrypt';
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
import { getDomain } from '$lib/components/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -86,9 +86,9 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/vscodeserver/stop.json.ts b/src/routes/services/[id]/vscodeserver/stop.json.ts
index e3faf42b5a..88406950ba 100644
--- a/src/routes/services/[id]/vscodeserver/stop.json.ts
+++ b/src/routes/services/[id]/vscodeserver/stop.json.ts
@@ -1,7 +1,7 @@
import { getUserDetails, removeDestinationDocker } from '$lib/common';
import { getDomain } from '$lib/components/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import { checkContainer, configureSimpleServiceProxyOff } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -33,6 +33,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/wordpress/index.json.ts b/src/routes/services/[id]/wordpress/index.json.ts
index ec49b77bad..413bd1f750 100644
--- a/src/routes/services/[id]/wordpress/index.json.ts
+++ b/src/routes/services/[id]/wordpress/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -19,6 +19,6 @@ export const post: RequestHandler = async (event) => {
await db.updateWordpress({ id, fqdn, name, extraConfig, mysqlDatabase });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/wordpress/start.json.ts b/src/routes/services/[id]/wordpress/start.json.ts
index 182cac0198..81fa1eda83 100644
--- a/src/routes/services/[id]/wordpress/start.json.ts
+++ b/src/routes/services/[id]/wordpress/start.json.ts
@@ -6,7 +6,7 @@ import type { RequestHandler } from '@sveltejs/kit';
import { letsEncrypt } from '$lib/letsencrypt';
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
import { getDomain } from '$lib/components/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
@@ -124,9 +124,9 @@ export const post: RequestHandler = async (event) => {
};
} catch (error) {
console.log(error);
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/[id]/wordpress/stop.json.ts b/src/routes/services/[id]/wordpress/stop.json.ts
index f8f9d31ddb..669d07d550 100644
--- a/src/routes/services/[id]/wordpress/stop.json.ts
+++ b/src/routes/services/[id]/wordpress/stop.json.ts
@@ -1,7 +1,7 @@
import { getUserDetails, removeDestinationDocker } from '$lib/common';
import { getDomain } from '$lib/components/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dockerInstance } from '$lib/docker';
import { checkContainer, configureSimpleServiceProxyOff } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
@@ -37,6 +37,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/services/index.json.ts b/src/routes/services/index.json.ts
index f1a8afbf99..9bd7a3dce7 100644
--- a/src/routes/services/index.json.ts
+++ b/src/routes/services/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -15,6 +15,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/settings/check.json.ts b/src/routes/settings/check.json.ts
index 78e770421a..0d099abe6d 100644
--- a/src/routes/settings/check.json.ts
+++ b/src/routes/settings/check.json.ts
@@ -1,6 +1,6 @@
import { asyncExecShell, getEngine, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -20,6 +20,6 @@ export const post: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/settings/index.json.ts b/src/routes/settings/index.json.ts
index 48604156a0..cad2402330 100644
--- a/src/routes/settings/index.json.ts
+++ b/src/routes/settings/index.json.ts
@@ -1,7 +1,7 @@
import { dev } from '$app/env';
import { getDomain, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { listSettings, PrismaErrorHandler } from '$lib/database';
+import { listSettings, ErrorHandler } from '$lib/database';
import {
checkContainer,
configureCoolifyProxyOff,
@@ -29,7 +29,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -55,7 +55,7 @@ export const del: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
export const post: RequestHandler = async (event) => {
@@ -112,6 +112,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/sources/[id]/check.json.ts b/src/routes/sources/[id]/check.json.ts
index e30b709429..fe7d8e9c01 100644
--- a/src/routes/sources/[id]/check.json.ts
+++ b/src/routes/sources/[id]/check.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -16,6 +16,6 @@ export const post: RequestHandler = async (event) => {
}
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/sources/[id]/gitlab.json.ts b/src/routes/sources/[id]/gitlab.json.ts
index b4f40d8aa6..8420669e60 100644
--- a/src/routes/sources/[id]/gitlab.json.ts
+++ b/src/routes/sources/[id]/gitlab.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -16,6 +16,6 @@ export const post: RequestHandler = async (event) => {
await db.addSource({ id, teamId, oauthId, groupName, appId, appSecret });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/sources/[id]/index.json.ts b/src/routes/sources/[id]/index.json.ts
index 1a30527638..58fb7008b0 100644
--- a/src/routes/sources/[id]/index.json.ts
+++ b/src/routes/sources/[id]/index.json.ts
@@ -1,6 +1,6 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (request) => {
@@ -19,7 +19,7 @@ export const get: RequestHandler = async (request) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -33,7 +33,7 @@ export const del: RequestHandler = async (request) => {
await db.removeSource({ id });
return { status: 200 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -49,6 +49,6 @@ export const post: RequestHandler = async (event) => {
await db.updateGitsource({ id, name });
return { status: 201 };
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/sources/index.json.ts b/src/routes/sources/index.json.ts
index bf774698ed..b4e89fce9c 100644
--- a/src/routes/sources/index.json.ts
+++ b/src/routes/sources/index.json.ts
@@ -1,6 +1,6 @@
import { getTeam, getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (request) => {
@@ -11,6 +11,6 @@ export const get: RequestHandler = async (request) => {
const sources = await db.listSources(teamId);
return { status: 200, body: { sources } };
} catch (err) {
- return PrismaErrorHandler(err);
+ return ErrorHandler(err);
}
};
diff --git a/src/routes/teams/[id]/index.json.ts b/src/routes/teams/[id]/index.json.ts
index fc3a441958..59536fd031 100644
--- a/src/routes/teams/[id]/index.json.ts
+++ b/src/routes/teams/[id]/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -33,7 +33,7 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -50,6 +50,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/teams/[id]/invitation/accept.json.ts b/src/routes/teams/[id]/invitation/accept.json.ts
index 253e483665..635283014b 100644
--- a/src/routes/teams/[id]/invitation/accept.json.ts
+++ b/src/routes/teams/[id]/invitation/accept.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dayjs } from '$lib/dayjs';
import type { RequestHandler } from '@sveltejs/kit';
@@ -31,6 +31,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/teams/[id]/invitation/invite.json.ts b/src/routes/teams/[id]/invitation/invite.json.ts
index 076fa22dfb..5354b0046d 100644
--- a/src/routes/teams/[id]/invitation/invite.json.ts
+++ b/src/routes/teams/[id]/invitation/invite.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dayjs } from '$lib/dayjs';
import type { RequestHandler } from '@sveltejs/kit';
@@ -64,6 +64,6 @@ export const post: RequestHandler = async (event) => {
};
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/teams/[id]/invitation/revoke.json.ts b/src/routes/teams/[id]/invitation/revoke.json.ts
index 07f7a2387c..43bb2c77f1 100644
--- a/src/routes/teams/[id]/invitation/revoke.json.ts
+++ b/src/routes/teams/[id]/invitation/revoke.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import { dayjs } from '$lib/dayjs';
import type { RequestHandler } from '@sveltejs/kit';
@@ -15,6 +15,6 @@ export const post: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/teams/[id]/permission/change.json.ts b/src/routes/teams/[id]/permission/change.json.ts
index 018b7772b5..792bdeecb0 100644
--- a/src/routes/teams/[id]/permission/change.json.ts
+++ b/src/routes/teams/[id]/permission/change.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -18,6 +18,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/teams/[id]/remove/user.json.ts b/src/routes/teams/[id]/remove/user.json.ts
index 6a82de694e..40b1c254bf 100644
--- a/src/routes/teams/[id]/remove/user.json.ts
+++ b/src/routes/teams/[id]/remove/user.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
@@ -19,6 +19,6 @@ export const post: RequestHandler = async (event) => {
status: 201
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/teams/index.json.ts b/src/routes/teams/index.json.ts
index d004ecb5da..cf8ff2583c 100644
--- a/src/routes/teams/index.json.ts
+++ b/src/routes/teams/index.json.ts
@@ -1,6 +1,6 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const get: RequestHandler = async (event) => {
@@ -21,6 +21,6 @@ export const get: RequestHandler = async (event) => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/update.json.ts b/src/routes/update.json.ts
index f5d43ab268..5c0e1581e4 100644
--- a/src/routes/update.json.ts
+++ b/src/routes/update.json.ts
@@ -1,7 +1,7 @@
import { dev } from '$app/env';
import { asyncExecShell, version } from '$lib/common';
import { asyncSleep } from '$lib/components/common';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
import compare from 'compare-versions';
import got from 'got';
@@ -21,7 +21,7 @@ export const get: RequestHandler = async () => {
}
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
@@ -44,7 +44,7 @@ export const post: RequestHandler = async (event) => {
};
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
} else if (type === 'update') {
try {
@@ -66,7 +66,7 @@ export const post: RequestHandler = async (event) => {
};
}
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
}
return {
diff --git a/src/routes/webhooks/github/index.ts b/src/routes/webhooks/github/index.ts
index b8fdd2e14c..f08556f646 100644
--- a/src/routes/webhooks/github/index.ts
+++ b/src/routes/webhooks/github/index.ts
@@ -1,7 +1,7 @@
import { dev } from '$app/env';
import { getTeam } from '$lib/common';
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const options = async () => {
@@ -36,6 +36,6 @@ export const get: RequestHandler = async (request) => {
headers: { Location: `/webhooks/success` }
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};
diff --git a/src/routes/webhooks/github/install.ts b/src/routes/webhooks/github/install.ts
index c535fb85b7..27a8a18708 100644
--- a/src/routes/webhooks/github/install.ts
+++ b/src/routes/webhooks/github/install.ts
@@ -1,5 +1,5 @@
import * as db from '$lib/database';
-import { PrismaErrorHandler } from '$lib/database';
+import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const options = async () => {
@@ -24,6 +24,6 @@ export const get: RequestHandler = async (request) => {
headers: { Location: `/webhooks/success` }
};
} catch (error) {
- return PrismaErrorHandler(error);
+ return ErrorHandler(error);
}
};