模板 / flowchart
API 错误处理流程
外部 API 调用的退避重试逻辑,区分可重试错误与不可恢复的失败。
预览
Mermaid 11 渲染器
正在渲染预览...
Mermaid 源码
flowchart
flowchart TD
request[Call external API] --> ok{2xx response?}
ok -->|yes| parse[Parse payload]
ok -->|no| type{Error type}
type -->|429 / 5xx| retry[Retry with backoff]
type -->|4xx| alert[Log + alert]
retry --> limit{Attempts left?}
limit -->|yes| request
limit -->|no| alert
parse --> done[Continue pipeline]
alert --> fallback[Serve cached fallback]