You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ingredients/v1/ingredients.controller.ts
+17-41Lines changed: 17 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -77,17 +77,13 @@ export class IngredientsV1Controller implements OnModuleInit {
77
77
@ApiTags("Ingredients")
78
78
@ApiResponse({
79
79
status: 200,
80
-
description: "Request returned a positive result.",
80
+
description:
81
+
"Request returned a positive result. If translation fails, results will be based on untranslated ingredients.",
81
82
})
82
83
@ApiResponse({
83
84
status: 500,
84
85
description: "Internal Server Error.",
85
86
})
86
-
@ApiResponse({
87
-
status: 503,
88
-
description:
89
-
"Service Unavailable. Translation service is unavailable. Try again with disabled translation (Results might vary). Add flag ?translate=false to the request.",
90
-
})
91
87
asyncgetIngredients(
92
88
@Param("ingredients")ingredientsParam: string,
93
89
@Res()res: Response,
@@ -128,34 +124,11 @@ export class IngredientsV1Controller implements OnModuleInit {
128
124
129
125
response=this.parseIngredients(translated);
130
126
}catch(error){
131
-
if(errorinstanceofError){
132
-
if(error.message==="Translate timed out"){
133
-
this.logger.error(`Translation service is unavailable: ${error}`);
134
-
res.status(HttpStatus.SERVICE_UNAVAILABLE).send({
135
-
code: "Service Unavailable",
136
-
status: "503",
137
-
message:
138
-
"Translation service is unavailable. Try again with disabled translation (Results might vary). Add flag ?translate=false to the request.",
139
-
});
140
-
return;
141
-
}else{
142
-
this.logger.error(`Error during translation: ${error}`);
0 commit comments