Skip to content

feat(SPV-1583) errorx & RFC 7807 problem details for admin endpoints #953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

chris-4chain
Copy link
Contributor

Examples:

{
  "detail": "Unsupported domain: 'krzysiek.4chain.pm'; Hint: Domain of provided paymail is not supported by this spv-wallet service",
  "instance": "config/unsupported_domain",
  "status": 400,
  "title": "Bad request",
  "type": "unsupported_domain"
}

{
  "detail": "Invalid avatar URL: 'asdasd/'; Hint: Avatar should have a valid scheme (http or https)",
  "instance": "paymail/invalid_avatar_url",
  "status": 422,
  "title": "Unprocessable entity",
  "type": "invalid_avatar_url"
}

{
  "detail": "Invalid avatar URL: 'https://asdasd^^'; Hint: Avatar should be a valid URL",
  "instance": "paymail/invalid_avatar_url",
  "status": 422,
  "title": "Unprocessable entity",
  "type": "invalid_avatar_url"
}

{
  "detail": "Invalid public key: 'wrong-key'",
  "instance": "",
  "status": 400,
  "title": "Bad request",
  "type": "invalid_public_key"
}

{
  "detail": "Invalid paymail address: test06031229krzysiek.test.4chain.space",
  "instance": "",
  "status": 400,
  "title": "Bad request",
  "type": "invalid_paymail_address"
}

{
  "detail": "Inconsistent alias@domain and address fields: test06031229, wrong-domain, [email protected]. Hint: use either alias and domain or address (not both)",
  "instance": "",
  "status": 400,
  "title": "Bad request",
  "type": "inconsistent_alias_domain_and_address"
}

{
  "detail": "",
  "instance": "db/not_found",
  "status": 404,
  "title": "Not found",
  "type": "not_found"
}

Pull Request Checklist

  • 📖 I created my PR using provided : CODE_STANDARDS
  • 📖 I have read the short Code of Conduct: CODE_OF_CONDUCT
  • 🏠 I tested my changes locally.
  • ✅ I have provided tests for my changes.
  • 📝 I have used conventional commits.
  • 📗 I have updated any related documentation.
  • 💾 PR was issued based on the Github or Jira issue.

@chris-4chain chris-4chain requested a review from a team as a code owner March 6, 2025 12:18
Copy link

github-actions bot commented Mar 6, 2025

Manual Tests

ℹ️ Remember to ask team members to perform manual tests and to assign tested label after testing.

# Conflicts:
#	api/gen.api.yaml
#	api/gen.models.go
#	api/manualtests/client/client.gen.go
@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 10.99291% with 251 lines in your changes missing coverage. Please review.

Project coverage is 34.50%. Comparing base (3ad6ae4) to head (c8ad1ef).

Files with missing lines Patch % Lines
logging/logging.go 0.00% 47 Missing ⚠️
errdef/clienterr/http_error.go 0.00% 37 Missing ⚠️
errdef/clienterr/builder.go 0.00% 29 Missing ⚠️
errdef/clienterr/mapper.go 0.00% 26 Missing ⚠️
errdef/problem_details.go 0.00% 18 Missing ⚠️
...ions/testabilities/assert_spvwallet_application.go 0.00% 15 Missing ⚠️
engine/tester/jsonrequire/funcs.go 0.00% 12 Missing ⚠️
engine/v2/paymails/paymails_service.go 0.00% 12 Missing ⚠️
engine/v2/users/users_service.go 0.00% 9 Missing ⚠️
errdef/clienterr/client_error_definition.go 0.00% 9 Missing ⚠️
... and 9 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #953      +/-   ##
==========================================
- Coverage   34.50%   34.50%   -0.01%     
==========================================
  Files         437      442       +5     
  Lines       20826    20913      +87     
==========================================
+ Hits         7186     7216      +30     
- Misses      13041    13101      +60     
+ Partials      599      596       -3     
Flag Coverage Δ
unittests 34.50% <10.99%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
actions/v2/admin/users/get.go 100.00% <100.00%> (+57.14%) ⬆️
api/gen.models.go 0.00% <ø> (ø)
cmd/main.go 0.00% <ø> (ø)
actions/v2/admin/users/paymail_add.go 85.18% <92.30%> (+5.18%) ⬆️
...ines/testabilities/mock_paymail_address_service.go 0.00% <0.00%> (ø)
actions/v2/admin/users/create.go 78.04% <84.21%> (+28.04%) ⬆️
config/utils.go 23.07% <0.00%> (-1.93%) ⬇️
engine/v2/database/repository/paymails.go 0.00% <0.00%> (ø)
engine/v2/database/repository/users.go 0.00% <0.00%> (ø)
engine/v2/database/errors/helpers.go 0.00% <0.00%> (ø)
... and 12 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ad6ae4...c8ad1ef. Read the comment docs.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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