Skip to content

fix (#903): improve error handling for missing parameters in WalletApiRoute#2266

Open
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-903
Open

fix (#903): improve error handling for missing parameters in WalletApiRoute#2266
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-903

Conversation

@dimension-drifter
Copy link
Copy Markdown

###Root Cause
The password directive in [WalletApiRoute.scala] uses a bare reject without providing specific error information when JSON parsing fails.
This causes Akka HTTP to generate a generic "Tag mismatch!" error message instead of a meaningful one.

###Solution
Updated the password directive (and other similar directives) to provide meaningful rejection messages.

###Changes Made
File: [WalletApiRoute.scala]
Fixed the following directives to provide meaningful error messages:

  • password - Used by /wallet/unlock endpoint
  • derivationPath - Used by /wallet/deriveKey endpoint
  • checkRequest - Used by /wallet/check endpoint
  • initRequest - Used by /wallet/init endpoint

File: [WalletApiRouteSpec.scala]
Added test cases to verify proper error messages:

  • Test /wallet/unlock with missing pass field
  • Test /wallet/unlock with empty JSON body
  • Test /wallet/deriveKey with missing derivationPath field

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