[Medium] Dead BSON conversion methods in GetTrailByIdQueryHandler #65

Closed
opened 2026-05-05 04:16:00 +00:00 by spikerj · 1 comment
Owner

Severity: Medium (maintainability)

File: SpikerSoft.Business/Domain/Map/Trails/Queries/GetTrailById/GetTrailByIdQueryHandler.cs (~63-116)

Problem: ConvertBsonToGeometry, ConvertBsonToDictionary, ConvertBsonValueToObject are declared but never called. ConvertToDto uses JsonSerializer exclusively. Dead code increases audit surface and confuses readers.

Fix: Remove the unused methods, OR if they're intentionally retained for an upcoming BSON path, leave a clear comment explaining why and add a // TODO issue link.

Acceptance criteria:

  • Dead methods removed (or documented with intent)
  • Build still passes
  • No behavior change
**Severity:** Medium (maintainability) **File:** `SpikerSoft.Business/Domain/Map/Trails/Queries/GetTrailById/GetTrailByIdQueryHandler.cs` (~63-116) **Problem:** `ConvertBsonToGeometry`, `ConvertBsonToDictionary`, `ConvertBsonValueToObject` are declared but never called. `ConvertToDto` uses `JsonSerializer` exclusively. Dead code increases audit surface and confuses readers. **Fix:** Remove the unused methods, OR if they're intentionally retained for an upcoming BSON path, leave a clear comment explaining why and add a `// TODO` issue link. **Acceptance criteria:** - [ ] Dead methods removed (or documented with intent) - [ ] Build still passes - [ ] No behavior change
Author
Owner

Resolved.

Removed the unused ConvertBsonToGeometry, ConvertBsonToDictionary, and ConvertBsonValueToObject methods plus the using MongoDB.Bson; import. Also simplified the handler -- the outer try/catch that re-wrapped every exception (including the not-found case) in a generic Exception was removed; the typed TrailNotFoundException (issue #57) now propagates cleanly.

File: SpikerSoft.Business/Domain/Map/Trails/Queries/GetTrailById/GetTrailByIdQueryHandler.cs.

**Resolved.** Removed the unused `ConvertBsonToGeometry`, `ConvertBsonToDictionary`, and `ConvertBsonValueToObject` methods plus the `using MongoDB.Bson;` import. Also simplified the handler -- the outer `try/catch` that re-wrapped every exception (including the not-found case) in a generic `Exception` was removed; the typed `TrailNotFoundException` (issue #57) now propagates cleanly. File: `SpikerSoft.Business/Domain/Map/Trails/Queries/GetTrailById/GetTrailByIdQueryHandler.cs`.
Sign in to join this conversation.