Skip to content

Commit b1ee09d

Browse files
authored
Merge pull request #26 from FlineDev/wip/docc
Add proper documentation & link to in README rather than all-in-one README
2 parents 917decc + fa0535d commit b1ee09d

15 files changed

+1688
-555
lines changed

README.md

Lines changed: 208 additions & 555 deletions
Large diffs are not rendered by default.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# ``ErrorKit``
2+
3+
Making error handling in Swift more intuitive and powerful with clearer messages, type safety, and user-friendly diagnostics.
4+
5+
@Metadata {
6+
@PageImage(purpose: icon, source: "ErrorKit")
7+
}
8+
9+
## Overview
10+
11+
Swift's error handling has several limitations that make it challenging to create robust, user-friendly applications:
12+
- The `Error` protocol's confusing behavior with `localizedDescription`
13+
- Hard-to-understand system error messages
14+
- Limited type safety in error propagation
15+
- Difficulties with error chain debugging
16+
- Challenges in collecting meaningful feedback from users
17+
18+
ErrorKit addresses these challenges with a suite of lightweight, interconnected features you can adopt progressively.
19+
20+
## Core Features
21+
22+
These foundational features improve how you define and present errors:
23+
24+
@Links(visualStyle: detailedGrid) {
25+
- <doc:Throwable-Protocol>
26+
- <doc:Enhanced-Error-Descriptions>
27+
}
28+
29+
## Swift 6 Typed Throws Support
30+
31+
Swift 6 introduces typed throws (`throws(ErrorType)`), bringing compile-time type checking to error handling. ErrorKit makes this powerful feature practical with solutions for its biggest challenges:
32+
33+
@Links(visualStyle: detailedGrid) {
34+
- <doc:Typed-Throws-and-Error-Nesting>
35+
- <doc:Error-Chain-Debugging>
36+
}
37+
38+
## Ready-to-Use Tools
39+
40+
These practical tools help you implement robust error handling with minimal effort:
41+
42+
@Links(visualStyle: detailedGrid) {
43+
- <doc:Built-in-Error-Types>
44+
- <doc:User-Feedback-with-Logs>
45+
}
46+
47+
## How These Features Work Together
48+
49+
ErrorKit's features are designed to complement each other while remaining independently useful:
50+
51+
1. **Start with improved error definitions** using `Throwable` for custom errors and `userFriendlyMessage(for:)` for system errors.
52+
53+
2. **Add type safety with Swift 6 typed throws**, using the `Catching` protocol to solve nested error challenges. This pairs with error chain debugging to understand error flows through your app.
54+
55+
3. **Save time with ready-made tools**: built-in error types for common scenarios and simple log collection for user feedback.
56+
57+
Each feature builds upon the foundations laid by the previous ones, but you can adopt any part independently based on your needs.
58+
59+
## Adoption Path
60+
61+
Here's a practical adoption strategy:
62+
63+
1. Replace `Error` with `Throwable` in your custom error types
64+
2. Use `ErrorKit.userFriendlyMessage(for:)` when showing system errors
65+
3. Adopt built-in error types where they fit your needs
66+
4. Implement typed throws with `Catching` for more robust error flows
67+
5. Add error chain debugging to improve error visibility
68+
6. Integrate log collection with your feedback system

0 commit comments

Comments
 (0)