金色时刻 · 15:48
让好资源,触手可及
AGENT SKILL

error-handling

error-handling 是面向软件开发的 Agent Skill,来自 HoangNguyen0403/agent-skills-standard。查看技能说明、操作步骤与使用约定,并通过原项目了解详细用法。

Functional error handling using Dartz and Either.

SKILL.md

下载 MD ↓
nameFlutter Error Handling
descriptionFunctional error handling using Dartz and Either.
metadata{"labels": ["error-handling", "dartz", "functional"], "triggers": {"files": ["lib/domain/**", "lib/infrastructure/**"], "keywords": ["Either", "fold", "Left", "Right", "Failure", "dartz"]}}

Error Handling

Priority: P1 (HIGH)

Standardized functional error handling using dartz and freezed failures.

Implementation Guidelines

  • Either Pattern: Return Either<Failure, T> from repositories. No exceptions in UI/BLoC.
  • Failures: Define domain-specific failures using @freezed unions.
  • Mapping: Infrastructure catches Exception and returns Left(Failure).
  • Consumption: Use .fold(failure, success) in BLoC to emit corresponding states.
  • Typed Errors: Use left(Failure()) and right(Value()) from Dartz.

Reference & Examples

For Failure definitions and API error mapping: See references/REFERENCE.md.

Related Topics

layer-based-clean-architecture | bloc-state-management

来源:HoangNguyen0403/agent-skills-standard · MIT 许可 · 许可原文 · MD 为来源页保存的历史版本