apache / apache/cloudstack

Improve Template/ISO Failure Status and Error Reporting

未关闭
#11,326 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
component:templates
主要语言
Java
星标
3.1k
派生
1.4k
平均合并
6 天 19 小时
30 天内合并 PR
32

描述

### The required feature described as a wish

**Description:**
In the ISO/Templates flow, error responses currently return detailed error messages directly in the status field. This leads to inconsistencies and complicates error handling.

**Proposal:**
Introduce two improvements to the API responses for Templates and ISOs:

1) Standardize the `status` Field for Failures
When any terminal error occurs during the processing of a template or ISO, the `status` field should consistently return `"Failed"`. This provides a clear and unambiguous final state for parsing.

2) Add a Detailed Error Message Field
A new field, named `error_details`, should be added to the Template/ISO API response object.
This field will contain a detailed error string explaining the reason for the failure.

**Example of the response**
Failed download status of the ISO/Template:
```
{
"id": "a1b2c3d4-xxxx-yyyy-zzzz-e5f6g7h8i9j0",
"name": "my-failed-template",
"status": "Failed",
"error_details": "HTTP Server returned 404 (expected 200 OK)",
....
}
```
Successful download status of the ISO/Template:
```
{
"id": "b1b2c3d4-xxxx-yyyy-zzzz-e5f6g7h8i9j1",
"name": "my-template",
"status": "Download Complete",
"error_details": null,
....
}
```
**Benefits:**
- Consistent error structure across ISO/Templates;
- Easier parsing, logging, and UI display of error messages;
- Avoids issues caused by leading/trailing spaces or unexpected values in status.

Tasks:
1) Update ISO/Templates logic to return "Failed" in the `status` field.
2) Return detailed error messages in the `error_details` field.

贡献指南

打开贡献指南

调研方向

首先,跟踪 issue 中描述的 ISO/Templates API 响应处理和终端错误路径。检查每个失败响应和成功下载响应,然后验证失败时使用带有 error_details 中详细消息的 "Failed",成功响应则对 error_details 使用 null 值。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api, cloud
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。