chore: standardize service domains and error logging
Build and Push Docker Images / detect-changes (push) Successful in 15s
Build and Push Docker Images / build-auth-api (push) Successful in 1m2s
Build and Push Docker Images / build-employee-api (push) Successful in 1m2s
Build and Push Docker Images / build-transit-api (push) Successful in 1m2s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m10s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m22s
Build and Push Docker Images / deploy-test-node (push) Successful in 4s

This commit is contained in:
Sven laptop
2026-09-18 19:26:05 +02:00
parent 3f0a02aa04
commit 1154d1d658
21 changed files with 609 additions and 380 deletions
+5 -4
View File
@@ -10,7 +10,8 @@ app.use(express.json());
app.use(cors());
const ERROR_LOG_API_URL =
process.env.ERROR_LOG_API_URL || "http://localhost:5003/error_log";
process.env.ERROR_LOG_API_URL ||
"https://error.xtransit.testinstance.nl/error_log";
function friendlyErrorMessage(statusCode) {
if (statusCode === 400) return "Controleer je invoer en probeer opnieuw.";
@@ -20,14 +21,14 @@ function friendlyErrorMessage(statusCode) {
return "Er ging iets mis. Probeer het later opnieuw.";
}
async function reportError({ partOfService, error }) {
async function reportError({ partofservice, error }) {
try {
await fetch(ERROR_LOG_API_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
service: "transit_api",
partOfService,
partofservice,
error,
}),
});
@@ -41,7 +42,7 @@ app.use((req, res, next) => {
const rawError =
body.error || body.message || body.details || `HTTP ${res.statusCode}`;
void reportError({
partOfService: `${req.method} ${req.originalUrl}`,
partofservice: `${req.method} ${req.originalUrl}`,
error: rawError,
});
return originalJson({ error: friendlyErrorMessage(res.statusCode) });