From e587cb7c28fc45d66c2452e56eaef211e2e7d12f Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Wed, 30 Oct 2024 23:10:06 +0000 Subject: [PATCH] return 503 if opensearch call failed Signed-off-by: Joshua Li --- server/routes/dsl.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/routes/dsl.ts b/server/routes/dsl.ts index 43bec95f1f..6318dccc02 100644 --- a/server/routes/dsl.ts +++ b/server/routes/dsl.ts @@ -42,7 +42,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -71,7 +71,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -95,7 +95,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -119,7 +119,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -158,7 +158,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -194,7 +194,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -230,7 +230,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -263,7 +263,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); } @@ -298,7 +298,7 @@ export function registerDslRoute( } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode === 500 ? 503 : error.statusCode || 503, body: error.message, }); }