Skip to content

fix(api): handle nulls in ranking query and log error stack trace (closes #84) - #114

Open
trexfr-ops wants to merge 3 commits into
Bitcoindefi:mainfrom
trexfr-ops:fix/issue-84-ranking-500-clean-db
Open

fix(api): handle nulls in ranking query and log error stack trace (closes #84)#114
trexfr-ops wants to merge 3 commits into
Bitcoindefi:mainfrom
trexfr-ops:fix/issue-84-ranking-500-clean-db

Conversation

@trexfr-ops

@trexfr-ops trexfr-ops commented Aug 20, 2026

Copy link
Copy Markdown

Description

Closes #84

This PR resolves the 500 error on the /ranking endpoint when executed against a clean database and ensures full error logging.

Key Changes

  1. Added full server-side stack trace logging with console.error("Error in GET /ranking handler:", error) in api/src/server.ts so any future internal handler failures are captured in the server log.
  2. Wrapped ciudadanos_matados and criminales_matados in COALESCE to guarantee safe arithmetic on nullable stats in api/src/repositories/characters.ts.
  3. Handled empty database queries cleanly returning status 200 with { characters: [] }.

/claim #84

  • EVM (Base/ETH): 0x32BB3df5B74a594956a0f33Bc353511Fa759FCa4
  • LTC: LPnftYop8yhRNQZstysT3vuJf3XkpQWKTC
  • Solana (SOL): 8Xo39uq9LoaM2rQEkgaaSfuThqHZTd18yGdJSXffkLwM
  • BTC: bc1qpyu6866qcgt26sqw4dn2mlmp8d0yc657fuedkv
  • DOGE: DDMU6D9TCE3BhqqYyy7MUZQD7JhfL39FpE

Summary by Gitar

  • Database Schema & Migrations:
    • Moved clan_members table definition before data migrations in api/schema.sql
    • Wrapped database migration script in an atomic transaction with rollback support in api/src/migrate.ts

This will update automatically on new commits.

@gitar-bot

gitar-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Refactors ranking query null handling and database migration scripts to resolve 500 errors on clean databases, while adding full error stack trace logging. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

El endpoint de ranking devuelve 500 en un entorno limpio

1 participant