LMS Validation and Error Handling
Summary
Source-backed Draft reference for LMS Validation and Error Handling across the implemented Training Service and, where applicable, Gateway surface.
Audience
API consumers, engineering, QA, support, architecture, security, product, and implementation reviewers.
Reference Content
Error mapping
| Source-backed condition | Result |
|---|---|
| Required tenant missing; domain value invalid | 400 through exception middleware |
| Explicit parent/resource absence | 404 |
| Published-course, enrollment, attempt, certificate lifecycle conflict | 409 |
| Document dependency unavailable | 503 through exception middleware |
| Document file absent | 404 through exception middleware |
| Successful create | 201 |
| Successful read/action/import | 200, except Gateway degraded results can be partial |
No forbidden branch, ProblemDetails configuration, or uniform Training envelope was found.
Validation layers
Endpoint helpers require selected titles/names, decode uploaded base64, parse material types and CSV values, and collect expected CSV row errors. Domain value records validate course codes/titles, durations, scores, and certificate numbers. Lifecycle checks cover published assignment, enrollment start/completion, duplicate attempt submission, issued certificate generation, and duplicate issue.
Persistence uniqueness provides duplicate protection for tenant course codes, employee/course enrollments, completion per enrollment, certificate numbers, and ordered path relationships. Duplicate writes may therefore surface provider exceptions because no general database exception mapping exists.
Important gaps
There is no independent request validator, consistent model-error envelope, file-size limit, schedule ordering/capacity rule, answer-derived scoring, explicit path prerequisite rule, or broad conflict mapping. Import commits valid rows together after processing and reports recognized row errors; an unhandled persistence failure can affect the batch.
Source References
microservices/src/training-service/Program.csmicroservices/src/training-service/Api/TrainingEndpoints.csmicroservices/src/training-service/Domain/TrainingEntities.csmicroservices/src/training-service/Infrastructure/TrainingDbContext.cs
Related Articles
See Also
Keywords
- LMS API
- Training Service
- Source-backed contract
Revision Information
- Status: Draft
- Last reviewed: 2026-07-17
- Review cycle: Quarterly