fix: Error handling
This commit is contained in:
@@ -110,23 +110,23 @@
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
onMount(async () => {
|
||||
if (
|
||||
service.type &&
|
||||
service.destinationDockerId &&
|
||||
service.version &&
|
||||
service.fqdn &&
|
||||
!isRunning
|
||||
) {
|
||||
try {
|
||||
await post(`/services/${service.id}/${service.type}/stop.json`, {});
|
||||
} catch ({ error }) {
|
||||
return errorNotification(error);
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
// onMount(async () => {
|
||||
// if (
|
||||
// service.type &&
|
||||
// service.destinationDockerId &&
|
||||
// service.version &&
|
||||
// service.fqdn &&
|
||||
// !isRunning
|
||||
// ) {
|
||||
// try {
|
||||
// await post(`/services/${service.id}/${service.type}/stop.json`, {});
|
||||
// } catch ({ error }) {
|
||||
// return errorNotification(error);
|
||||
// } finally {
|
||||
// loading = false;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
</script>
|
||||
|
||||
<nav class="nav-side">
|
||||
|
||||
@@ -5,6 +5,7 @@ import yaml from 'js-yaml';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import { letsEncrypt } from '$lib/letsencrypt';
|
||||
import {
|
||||
checkHAProxy,
|
||||
configureSimpleServiceProxyOn,
|
||||
reloadHaproxy,
|
||||
setWwwRedirection,
|
||||
@@ -22,6 +23,7 @@ export const post: RequestHandler = async (event) => {
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await checkHAProxy();
|
||||
const service = await db.getService({ id, teamId });
|
||||
const {
|
||||
type,
|
||||
|
||||
@@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import { letsEncrypt } from '$lib/letsencrypt';
|
||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
||||
import {
|
||||
checkHAProxy,
|
||||
configureSimpleServiceProxyOn,
|
||||
reloadHaproxy,
|
||||
setWwwRedirection
|
||||
} from '$lib/haproxy';
|
||||
import { getDomain } from '$lib/components/common';
|
||||
import { ErrorHandler } from '$lib/database';
|
||||
|
||||
@@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await checkHAProxy();
|
||||
const service = await db.getService({ id, teamId });
|
||||
const { type, version, fqdn, destinationDockerId, destinationDocker } = service;
|
||||
|
||||
@@ -58,7 +64,6 @@ export const post: RequestHandler = async (event) => {
|
||||
status: 200
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return ErrorHandler(error);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import { letsEncrypt } from '$lib/letsencrypt';
|
||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
||||
import {
|
||||
checkHAProxy,
|
||||
configureSimpleServiceProxyOn,
|
||||
reloadHaproxy,
|
||||
setWwwRedirection
|
||||
} from '$lib/haproxy';
|
||||
import { getDomain } from '$lib/components/common';
|
||||
import { ErrorHandler } from '$lib/database';
|
||||
|
||||
@@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await checkHAProxy();
|
||||
const service = await db.getService({ id, teamId });
|
||||
const {
|
||||
type,
|
||||
|
||||
@@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import { letsEncrypt } from '$lib/letsencrypt';
|
||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
||||
import {
|
||||
checkHAProxy,
|
||||
configureSimpleServiceProxyOn,
|
||||
reloadHaproxy,
|
||||
setWwwRedirection
|
||||
} from '$lib/haproxy';
|
||||
import { getDomain } from '$lib/components/common';
|
||||
import { getServiceImage, ErrorHandler } from '$lib/database';
|
||||
|
||||
@@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await checkHAProxy();
|
||||
const service = await db.getService({ id, teamId });
|
||||
const { type, version, fqdn, destinationDockerId, destinationDocker } = service;
|
||||
|
||||
|
||||
@@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import { letsEncrypt } from '$lib/letsencrypt';
|
||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
||||
import {
|
||||
checkHAProxy,
|
||||
configureSimpleServiceProxyOn,
|
||||
reloadHaproxy,
|
||||
setWwwRedirection
|
||||
} from '$lib/haproxy';
|
||||
import { getDomain } from '$lib/components/common';
|
||||
import { ErrorHandler } from '$lib/database';
|
||||
|
||||
@@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await checkHAProxy();
|
||||
const service = await db.getService({ id, teamId });
|
||||
const {
|
||||
type,
|
||||
|
||||
@@ -4,7 +4,12 @@ import { promises as fs } from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import { letsEncrypt } from '$lib/letsencrypt';
|
||||
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
|
||||
import {
|
||||
checkHAProxy,
|
||||
configureSimpleServiceProxyOn,
|
||||
reloadHaproxy,
|
||||
setWwwRedirection
|
||||
} from '$lib/haproxy';
|
||||
import { getDomain } from '$lib/components/common';
|
||||
import { ErrorHandler } from '$lib/database';
|
||||
|
||||
@@ -15,6 +20,7 @@ export const post: RequestHandler = async (event) => {
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await checkHAProxy();
|
||||
const service = await db.getService({ id, teamId });
|
||||
const {
|
||||
type,
|
||||
|
||||
Reference in New Issue
Block a user