Skip to main content

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 conditionResult
Required tenant missing; domain value invalid400 through exception middleware
Explicit parent/resource absence404
Published-course, enrollment, attempt, certificate lifecycle conflict409
Document dependency unavailable503 through exception middleware
Document file absent404 through exception middleware
Successful create201
Successful read/action/import200, 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.cs
  • microservices/src/training-service/Api/TrainingEndpoints.cs
  • microservices/src/training-service/Domain/TrainingEntities.cs
  • microservices/src/training-service/Infrastructure/TrainingDbContext.cs

See Also

Keywords

  • LMS API
  • Training Service
  • Source-backed contract

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-17
  • Review cycle: Quarterly