Skip to content

fix:update block#319

Merged
hexqi merged 1 commit into
opentiny:developfrom
msslulu:fix/updatebockbug
Jul 2, 2026
Merged

fix:update block#319
hexqi merged 1 commit into
opentiny:developfrom
msslulu:fix/updatebockbug

Conversation

@msslulu

@msslulu msslulu commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

修复更新被锁定区块的提示错误码和错误信息

Summary by CodeRabbit

  • Bug Fixes
    • Updated the response shown when trying to edit a block already locked by someone else.
    • Added a clearer error message for this case so users now see a more accurate reason the action is blocked.
    • Corrected an enum entry so additional status messages can be handled properly.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds a new CM346 enum constant to ExceptionEnum with a lock-conflict message, and updates BlockServiceImpl.updateBlockById to return this new error code instead of CM007 when a block's occupier doesn't match the current user.

Changes

Block lock error code

Layer / File(s) Summary
Add CM346 error code and use it in block update check
base/src/main/java/com/tinyengine/it/common/exception/ExceptionEnum.java, base/src/main/java/com/tinyengine/it/service/material/impl/BlockServiceImpl.java
Adds CM346("CM346", "当前区块已被其他用户锁定") to ExceptionEnum and fixes the CM345 delimiter; updateBlockById now returns Result.failed(ExceptionEnum.CM346) instead of CM007 on occupier mismatch.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A new code hops into the enum's den,
CM346, marking a lock again.
The old CM007 steps aside,
As the rightful message takes its stride.
Thump thump—small change, tidy and clean! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is related to the main change, though it is broad and does not mention the locked-block error handling update.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@msslulu msslulu changed the title fix:upload block fix:update block Jul 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
base/src/main/java/com/tinyengine/it/common/exception/ExceptionEnum.java (1)

355-360: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant duplicate semicolon after CM346.

Line 359 already terminates the enum-constant list with ;; the standalone ; on line 360 is a dead empty declaration. It compiles (Java allows empty class-body statements) but is unnecessary noise.

🧹 Suggested cleanup
     CM346("CM346", "当前区块已被其他用户锁定");
-    ;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@base/src/main/java/com/tinyengine/it/common/exception/ExceptionEnum.java`
around lines 355 - 360, Remove the redundant standalone semicolon after the
ExceptionEnum constants: the enum list already ends with the semicolon on CM346,
so delete the extra empty declaration and leave the enum body ending cleanly
after CM346 in ExceptionEnum.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@base/src/main/java/com/tinyengine/it/common/exception/ExceptionEnum.java`:
- Around line 355-360: Remove the redundant standalone semicolon after the
ExceptionEnum constants: the enum list already ends with the semicolon on CM346,
so delete the extra empty declaration and leave the enum body ending cleanly
after CM346 in ExceptionEnum.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 026b11cb-868a-43d0-a1bc-4aa7e97141e7

📥 Commits

Reviewing files that changed from the base of the PR and between 0898769 and 6d05348.

📒 Files selected for processing (2)
  • base/src/main/java/com/tinyengine/it/common/exception/ExceptionEnum.java
  • base/src/main/java/com/tinyengine/it/service/material/impl/BlockServiceImpl.java

@hexqi hexqi merged commit 4a82d4a into opentiny:develop Jul 2, 2026
1 check 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.

2 participants