Skip to content

fix(route): distinguish return route not found errors - #12

Merged
ccjngwn merged 1 commit into
developfrom
feat/return-route-error-codes
Jul 10, 2026
Merged

fix(route): distinguish return route not found errors#12
ccjngwn merged 1 commit into
developfrom
feat/return-route-error-codes

Conversation

@ccjngwn

@ccjngwn ccjngwn commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Added dedicated error codes for return route creation and lookup failure cases.
  • Updated ReturnRouteService to throw specific ErrorCodes instead of falling back to COMMON_404.
  • Included direction and gapMinutes in the return route city candidate failure message and server log.
  • Added service tests for missing result, forbidden result, missing city candidate, missing Seoul data, missing in-progress route, and missing route day cases.

Why

Swagger testing was difficult because multiple unrelated failure causes were all returned as COMMON_404. The API response now exposes a distinct code/message for each expected route failure.

Validation

  • ./gradlew test

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for return-route and sleep-jetlag features.
    • Added specific notifications when route data, route days, cities, or sleep results are unavailable.
    • Added clearer access-denied responses when viewing another user’s sleep-jetlag result.
    • Error responses now display the most relevant contextual message, including details when no suitable route city is found.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c2081c4-e82d-4fd7-96e7-859f0a69523d

📥 Commits

Reviewing files that changed from the base of the PR and between 043e55b and 556fd55.

📒 Files selected for processing (5)
  • src/main/java/com/cotato/cokerthon/domain/route/service/ReturnRouteService.java
  • src/main/java/com/cotato/cokerthon/global/exception/BusinessException.java
  • src/main/java/com/cotato/cokerthon/global/exception/ErrorCode.java
  • src/main/java/com/cotato/cokerthon/global/exception/GlobalExceptionHandler.java
  • src/test/java/com/cotato/cokerthon/domain/route/service/ReturnRouteServiceTest.java

📝 Walkthrough

Walkthrough

ReturnRouteService now uses specific business error codes and contextual messages for missing or unauthorized data. Exception responses preserve explicit messages, and comprehensive unit tests cover route creation and current-route lookup failures.

Changes

Return-route error handling

Layer / File(s) Summary
Specific error response contracts
src/main/java/com/cotato/cokerthon/global/exception/ErrorCode.java, src/main/java/com/cotato/cokerthon/global/exception/BusinessException.java, src/main/java/com/cotato/cokerthon/global/exception/GlobalExceptionHandler.java
Adds six route and sleep-result error codes, supports explicit BusinessException messages, and returns those messages in error responses.
Return-route failure handling
src/main/java/com/cotato/cokerthon/domain/route/service/ReturnRouteService.java
Uses specific errors for missing sleep results, ownership mismatches, missing routes or route days, missing city candidates, and missing previous-day data; logs missing city candidates with direction and gap details.
Failure-case test coverage
src/test/java/com/cotato/cokerthon/domain/route/service/ReturnRouteServiceTest.java
Adds unit tests for the updated error codes, contextual city-generation messages, missing Seoul data, missing current routes, and missing current route days.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/return-route-error-codes

Comment @coderabbitai help to get the list of available commands.

@ccjngwn
ccjngwn marked this pull request as ready for review July 10, 2026 19:02
@ccjngwn
ccjngwn merged commit 47aa53b into develop Jul 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant