mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Catch errors return error response when fetching chart or chart values fails (#1478)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
2f17a7ec67
commit
19150fca84
@ -12,14 +12,22 @@ class HelmApiRoute extends LensApi {
|
|||||||
|
|
||||||
public async getChart(request: LensApiRequest) {
|
public async getChart(request: LensApiRequest) {
|
||||||
const { params, query, response } = request;
|
const { params, query, response } = request;
|
||||||
const chart = await helmService.getChart(params.repo, params.chart, query.get("version"));
|
try {
|
||||||
this.respondJson(response, chart);
|
const chart = await helmService.getChart(params.repo, params.chart, query.get("version"));
|
||||||
|
this.respondJson(response, chart);
|
||||||
|
} catch (error) {
|
||||||
|
this.respondText(response, error, 422);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getChartValues(request: LensApiRequest) {
|
public async getChartValues(request: LensApiRequest) {
|
||||||
const { params, query, response } = request;
|
const { params, query, response } = request;
|
||||||
const values = await helmService.getChartValues(params.repo, params.chart, query.get("version"));
|
try {
|
||||||
this.respondJson(response, values);
|
const values = await helmService.getChartValues(params.repo, params.chart, query.get("version"));
|
||||||
|
this.respondJson(response, values);
|
||||||
|
} catch (error) {
|
||||||
|
this.respondText(response, error, 422);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async installChart(request: LensApiRequest) {
|
public async installChart(request: LensApiRequest) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user