5de74b543a
VDE-001 through VDE-013 all resolved in v1.0.1 ViewDesign workarounds can now be removed
36 lines
893 B
Markdown
36 lines
893 B
Markdown
---
|
||
id: VDE-011
|
||
status: fixed
|
||
severity: medium
|
||
category: api
|
||
date: 2026-07-27
|
||
reporter: ViewDesign
|
||
---
|
||
|
||
# VDE-011: write_stl / write_stl_ascii 返回 void
|
||
|
||
## 问题描述
|
||
|
||
write_stl() 和 write_stl_ascii() 的返回类型为 void,调用者无法判断写入是否成功。规范的做法是返回 bool 或抛出异常(如 read_stl 所做的)。函数签名:
|
||
|
||
```cpp
|
||
void write_stl(const std::string& filepath, const std::vector<StlTriangle>& tris);
|
||
```
|
||
|
||
## 影响文件
|
||
|
||
- include/vde/foundation/io_stl.h
|
||
|
||
## ViewDesign 侧 Workaround
|
||
|
||
调用后假定成功,返回 true。
|
||
|
||
## 建议修复方向
|
||
|
||
1. 改为返回 bool(或 std::expected<void, Error> 在 C++23)
|
||
2. 像 read_stl 一样在失败时抛出 std::runtime_error
|
||
3. 至少应在文档中说明该函数如何报告写入失败
|
||
|
||
---
|
||
*此文件由 ViewDesign 工程自动生成。处理完成后请更新 status 字段。*
|