Skip to content

Commit

Permalink
fix error case cause failure to load anything
Browse files Browse the repository at this point in the history
  • Loading branch information
benphelps committed Sep 11, 2022
1 parent e3237b9 commit d861264
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/pages/api/services/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import { servicesFromConfig, servicesFromDocker, cleanServiceGroups } from "utils/service-helpers";

export default async function handler(req, res) {
const discoveredServices = cleanServiceGroups(await servicesFromDocker());
const configuredServices = cleanServiceGroups(await servicesFromConfig());
let discoveredServices;
let configuredServices;

try {
discoveredServices = cleanServiceGroups(await servicesFromDocker());
} catch {
discoveredServices = [];
}

try {
configuredServices = cleanServiceGroups(await servicesFromConfig());
} catch {
configuredServices = [];
}

const mergedGroupsNames = [
...new Set([discoveredServices.map((group) => group.name), configuredServices.map((group) => group.name)].flat()),
Expand Down

0 comments on commit d861264

Please sign in to comment.