Skip to content

Commit

Permalink
return 503 if opensearch call failed
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Oct 30, 2024
1 parent 39bb832 commit e587cb7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions server/routes/dsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -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,
});
}
Expand All @@ -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,
});
}
Expand All @@ -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,
});
}
Expand Down Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -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,
});
}
Expand Down

0 comments on commit e587cb7

Please sign in to comment.