first commit

This commit is contained in:
2026-09-21 17:37:53 +08:00
commit 67d4dd5b7c
141 changed files with 8558 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
/// 统一 API 异常(对齐 uniApp request.js 的错误语义)
class ApiException implements Exception {
final int code;
final String message;
ApiException(this.code, this.message);
@override
String toString() => 'ApiException($code, $message)';
}
/// 从任意抛出对象中提取 ApiException(供 UI/Provider 捕获使用)
ApiException asApiException(Object error) {
if (error is ApiException) return error;
return ApiException(-1, error.toString());
}