Skip to content

Commit 078a3d9

Browse files
committed
docs(errors): 1.0.0-alpha.4 에러 시스템 재설계를 문서 전반에 전파 (Stage 5)
Stage 1~4에서 완료된 에러 시스템 리팩터링을 Docs.Site·CLAUDE.md· README·VERIFICATION.md 등 146개 문서 파일에 일괄 반영. 일괄 치환 (self-contained 튜토리얼·릴리스 노트 제외): - 타입 rename: - DomainErrorType → DomainErrorKind - ApplicationErrorType → ApplicationErrorKind - AdapterErrorType → AdapterErrorKind - ErrorType → ErrorKind - ErrorCodeFactory → ErrorFactory - ErrorCodeExpected → ExpectedError (+ Base) - ErrorCodeExceptional → ExceptionalError - ErrorCodeFieldNames → ErrorLogFieldNames - 메서드 rename: - ErrorCodeFactory.Create → ErrorFactory.CreateExpected - ErrorCodeFactory.CreateFromException → ErrorFactory.CreateExceptional - 상수·필드 rename: - ErrorCodeId → NumericCode - ErrorType.*ErrorsPrefix → ErrorCodePrefixes.{Domain,Application,Adapter} - ArchTestContract 이전: - IValueObject.CreateMethodName → IValueObject.ArchTestContract.CreateMethodName - IValueObject.CreateFromValidatedMethodName → IValueObject.ArchTestContract.* - IValueObject.ValidateMethodName → IValueObject.ArchTestContract.* - IValueObject.DomainErrorsNestedClassName → IValueObject.ArchTestContract.NestedErrorsClassName - IEntity.CreateMethodName → IEntity.ArchTestContract.CreateMethodName - IEntity.CreateFromValidatedMethodName → IEntity.ArchTestContract.* - 에러 코드 문자열 값 단축: - "DomainErrors.X.Y" → "Domain.X.Y" - "ApplicationErrors.X.Y" → "Application.X.Y" - "AdapterErrors.X.Y" → "Adapter.X.Y" - prefix 테이블 업데이트: spec/04·guides/domain/08c 레이어 접두사 표 수동 정제 (spec/04-error-system.md): - ErrorKind 본문에서 제거된 prefix 상수 3개 설명 삭제, 내부 ErrorCodePrefixes 설명으로 교체 - 관계도 섹션 제목·preamble·말미 노트를 1.0.0-alpha.4 적용 기준으로 교정 제외 대상: - 릴리스 노트(.release-notes): 과거 시점 기록이므로 그대로 보존 - Self-contained 튜토리얼 4개(part1-valueobject-concepts/13,14,15,16): 자체 Framework 복사본을 쓰는 독립 교재 - Tests.Sandbox: 실험용 문서 참고: 관측성 로그 필드 ErrorType → Kind, 숫자 코드 ErrorCodeId → NumericCode 변경은 코드와 함께 이미 Stage 3.3/3.4에서 반영됨. 외부 대시보드(Seq·Grafana·Elastic) 쿼리가 이 필드를 참조하면 릴리스 노트의 마이그레이션 가이드를 확인하세요.
1 parent b939647 commit 078a3d9

146 files changed

Lines changed: 54056 additions & 54066 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ Src/Functorium.Adapters/
6363
### 2. 레이어별 타입 안전 에러
6464

6565
```csharp
66-
// Domain — DomainErrorType sealed record 사용
67-
DomainError.For<Email>(new DomainErrorType.Empty(), value, "이메일은 비어있을 수 없습니다");
68-
// → 에러 코드: "DomainErrors.Email.Empty"
66+
// Domain — DomainErrorKind sealed record 사용
67+
DomainError.For<Email>(new DomainErrorKind.Empty(), value, "이메일은 비어있을 수 없습니다");
68+
// → 에러 코드: "Domain.Email.Empty"
6969
70-
// Application — ApplicationErrorType sealed record 사용
71-
ApplicationError.For<CreateProductCommand>(new ApplicationErrorType.AlreadyExists(), id, "이미 존재합니다");
72-
// → 에러 코드: "ApplicationErrors.CreateProductCommand.AlreadyExists"
70+
// Application — ApplicationErrorKind sealed record 사용
71+
ApplicationError.For<CreateProductCommand>(new ApplicationErrorKind.AlreadyExists(), id, "이미 존재합니다");
72+
// → 에러 코드: "Application.CreateProductCommand.AlreadyExists"
7373
74-
// Adapter — AdapterErrorType sealed record 사용
75-
AdapterError.For<ProductRepository>(new AdapterErrorType.NotFound(), id, "찾을 수 없습니다");
76-
// → 에러 코드: "AdapterErrors.ProductRepository.NotFound"
74+
// Adapter — AdapterErrorKind sealed record 사용
75+
AdapterError.For<ProductRepository>(new AdapterErrorKind.NotFound(), id, "찾을 수 없습니다");
76+
// → 에러 코드: "Adapter.ProductRepository.NotFound"
7777
```
7878

7979
에러 코드 형식: `{LayerPrefix}.{Context}.{ErrorName}`
8080

81-
커스텀 에러 확장: `public sealed record InsufficientStock : DomainErrorType.Custom;`
81+
커스텀 에러 확장: `public sealed record InsufficientStock : DomainErrorKind.Custom;`
8282

8383
### 3. 파이프라인 Opt-in
8484

@@ -106,7 +106,7 @@ services.RegisterOpenTelemetry(configuration, assembly)
106106
### 5. 내부 구현 공유 패턴
107107

108108
- `LayerErrorCore` — DomainError/ApplicationError/AdapterError의 공통 에러 생성 로직 (internal)
109-
- `ErrorCodeExpectedBase`ErrorCodeExpected 4개 타입의 공통 override 기반 클래스 (internal, `sealed override ToString()`)
109+
- `ExpectedErrorBase`ExpectedError 4개 타입의 공통 override 기반 클래스 (internal, `sealed override ToString()`)
110110
- `ErrorAssertionCore` — 3개 레이어 Assertion의 공통 검증 로직 (internal)
111111

112112
---
@@ -163,7 +163,7 @@ dotnet test --solution Docs.Site/src/content/docs/tutorials/<name>/<PascalName>.
163163

164164
| 대상 | 규칙 | 예시 |
165165
|------|------|------|
166-
| ErrorType 카테고리 파일 | `{Layer}ErrorType.{Category}.cs` | `DomainErrorType.Presence.cs` |
166+
| ErrorKind 카테고리 파일 | `{Layer}ErrorKind.{Category}.cs` | `DomainErrorKind.Presence.cs` |
167167
| Helper 클래스 | `{Layer}Error.cs` | `DomainError.cs` |
168168
| Assertion 클래스 | `{Layer}ErrorAssertions.cs` | `DomainErrorAssertions.cs` |
169169
| Pipeline | `Usecase{Concern}Pipeline.cs` | `UsecaseLoggingPipeline.cs` |
@@ -172,7 +172,7 @@ dotnet test --solution Docs.Site/src/content/docs/tutorials/<name>/<PascalName>.
172172

173173
### 패턴
174174

175-
- **ErrorType**: `abstract partial record` + 카테고리별 partial 파일로 분리
175+
- **ErrorKind**: `abstract partial record` + 카테고리별 partial 파일로 분리
176176
- **Helper 클래스**: `LayerErrorCore`에 위임하는 thin wrapper (`[AggressiveInlining]`)
177177
- **Assertion**: `ErrorAssertionCore`에 위임하는 thin wrapper
178178
- **Repository**: 추상 base 클래스 + `ToDomain`/`ToModel` abstract 메서드
@@ -184,7 +184,7 @@ dotnet test --solution Docs.Site/src/content/docs/tutorials/<name>/<PascalName>.
184184

185185
- `throw` 사용 금지 — `Fin.Fail<T>(error)` 사용
186186
- 레이어 역방향 참조 금지 — Domains → Applications (단방향만)
187-
- `DomainError.For`에 다른 레이어 ErrorType 전달 금지 — 컴파일 타임 강제
187+
- `DomainError.For`에 다른 레이어 ErrorKind 전달 금지 — 컴파일 타임 강제
188188
- `new` 키워드로 Entity/ValueObject 직접 생성 금지 — 팩토리 메서드 사용
189189
- Pipeline에서 `UseAll()` 사용 금지 — 제거됨, 명시적 opt-in만
190190
- `.api/` 폴더 파일 수동 수정 금지 — 빌드 시 자동 생성되는 Public API Surface 파일. `dotnet build`가 자동 갱신하므로 직접 편집하지 않는다

Docs.Site/src/content/docs/adr/0001-foundation-use-fin-over-exceptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Functorium must solve this problem at the type level. A type system is needed th
5555

5656
- <span class="adr-good">Good</span>, because it is widely used in the .NET ecosystem, reducing onboarding effort for new team members.
5757
- <span class="adr-bad">Bad</span>, because it does not support `Bind`/`Map`/LINQ composition, so connecting multiple steps ultimately regresses to if-else branching.
58-
- <span class="adr-bad">Bad</span>, because errors are string-based, making type-safe classification like `DomainErrorType.InsufficientStock` and pattern matching impossible.
58+
- <span class="adr-bad">Bad</span>, because errors are string-based, making type-safe classification like `DomainErrorKind.InsufficientStock` and pattern matching impossible.
5959

6060
### ErrorOr Library
6161

Docs.Site/src/content/docs/adr/0002-foundation-languageext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ A functional library adopted at the framework level affects every layer from Dom
5656
- <span class="adr-good">Good</span>, because it provides a lightweight discriminated union with `Match` for pattern matching, and is simple to adopt.
5757
- <span class="adr-bad">Bad</span>, because it does not support LINQ composition, so multi-step business pipelines cannot be constructed declaratively.
5858
- <span class="adr-bad">Bad</span>, because there are no monadic operations like `Bind`/`Map`, requiring manual branching to connect each step's result to the next.
59-
- <span class="adr-bad">Bad</span>, because positional type parameters in the form `OneOf<T0, T1, T2>` cannot express a structural error classification system like `DomainErrorType`.
59+
- <span class="adr-bad">Bad</span>, because positional type parameters in the form `OneOf<T0, T1, T2>` cannot express a structural error classification system like `DomainErrorKind`.
6060

6161
### Custom Implementation
6262

Docs.Site/src/content/docs/adr/0005-domain-union-valueobject-state-machine.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Each state is defined as a sealed record inheriting `UnionValueObject<TSelf>`, w
2727

2828
- **Match**: Takes a function for every state as arguments and returns a result. If any state is missing, it immediately produces a compile error.
2929
- **Switch**: Same as Match but performs side effects without a return value.
30-
- **State transitions**: `TransitionTo()` methods defined on each state type express only allowed transitions at the type level. Invalid transitions like Shipped to Draft return `DomainErrorType.InvalidTransition`, and methods for disallowed transitions simply do not exist.
30+
- **State transitions**: `TransitionTo()` methods defined on each state type express only allowed transitions at the type level. Invalid transitions like Shipped to Draft return `DomainErrorKind.InvalidTransition`, and methods for disallowed transitions simply do not exist.
3131

3232
Since this is Value Object-based, immutability is guaranteed. State-specific associated data (e.g., a tracking number on the Shipped state) can be attached in a type-safe manner, and it integrates naturally with LINQ and collection operations.
3333

0 commit comments

Comments
 (0)