Skip to content

Conversation

@Lechros
Copy link
Owner

@Lechros Lechros commented Dec 6, 2025

Note

Replace TypeError usages across gear APIs with GearError (with gear/status context) and introduce _DeferredGearError; update docs/tests accordingly.

  • Core error handling:
    • Introduce GearError (includes gearId, gearName, and status).
    • Replace TypeError with GearError across Gear methods and enhance modules; use RangeError for value range checks where appropriate.
  • Enhance modules:
    • AddOption: add _DeferredGearError to compute values context-free and rethrow as GearError; update apply/reset/get* to throw GearError with status.
    • Starforce: starforce, starScroll, resetStarforce, recalculateStarforce now throw GearError with detailed status; internal _getValue likewise.
    • Upgrade: failScroll, resileScroll, resetUpgrade, applyScroll now throw GearError with status.
    • SpellTrace: validate gear/type/rate and throw GearError with status; add glove handling in getSpellTraceScroll.
    • Potential: set/resetPotential, set/resetAdditionalPotential throw GearError (and RangeError for invalid grades).
    • SoulSlot: applySoulEnchant, setSoul, setSoulCharge throw GearError (and RangeError for invalid charge).
  • Gear API/docs: JSDoc updated to reference GearError instead of TypeError throughout.
  • Tests: Update expectations to GearError/RangeError; add coverage for _DeferredGearError paths.
  • Meta: Add changeset; minor workspace/lockfile updates.

Written by Cursor Bugbot for commit ef158e5. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Dec 6, 2025

🦋 Changeset detected

Latest commit: ef158e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@malib/gear Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 6, 2025

Deploying malib-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: ef158e5
Status:🚫  Build failed.

View logs

@Lechros Lechros merged commit 86b9d07 into main Dec 6, 2025
3 of 4 checks passed
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

* @param gear 초기화할 장비.
*
* @throws {@link TypeError}
* @throws {@link GearError}
Copy link

Choose a reason for hiding this comment

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

Bug: Inconsistent error type for invalid options in setPotential

The setPotential function throws TypeError for invalid options.length, but the equivalent validation in setAdditionalPotential was updated to throw GearError with detailed debugging information. This appears to be an incomplete refactoring, since the PR's intent is to throw GearError with more information for debugging. The functions now have inconsistent error handling behavior for the same type of validation failure.

Additional Locations (1)

Fix in Cursor Fix in Web

@Lechros Lechros mentioned this pull request Dec 8, 2025
Lechros added a commit that referenced this pull request Dec 8, 2025
refactor: throw GearError with more information to help debugging
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