docs: update LLM guides for models and layout rules
Document new GUIDE.md expectations for src-layer edits and add index entries for models and shared types. Clarify layout usage, composable placement, error page conventions, and model/type ownership so future changes follow the intended layer boundaries.docs: update LLM guides for models and layout rules Document new GUIDE.md expectations for src-layer edits and add index entries for models and shared types. Clarify layout usage, composable placement, error page conventions, and model/type ownership so future changes follow the intended layer boundaries.
This commit is contained in:
@@ -17,6 +17,14 @@ component/view -> store/composable -> service module -> httpClient -> hooks
|
||||
- request option 可接收 `signal`。
|
||||
- 錯誤正規化交給既有 error/http hooks 流程。
|
||||
|
||||
## 錯誤處理體系
|
||||
|
||||
- `error.ts`:定義 `ApiRequestError`(正規化後的錯誤類別)、`CanceledRequestError`(取消請求)、`normalizeError()`(將 ky HTTPError / TimeoutError / DOMException 統一轉為 `ApiRequestError`)。
|
||||
- `http-error.ts`:ky `beforeError` hook,將 response body 的錯誤訊息注入 error 物件。
|
||||
- `http-toast.ts`:全域 HTTP error toast,依 status code 顯示對應 snackbar。
|
||||
|
||||
service module 不需要自行 catch 並處理錯誤,交由 interceptors/hooks 與上層 composable(如 `useApiCall`)處理。
|
||||
|
||||
## ky 注意事項
|
||||
|
||||
- 本專案使用 ky,不使用 axios。
|
||||
|
||||
Reference in New Issue
Block a user