16

Not sure what happened exactly... it was working fine and I didn't change anything in this file. It has to be related to something I did recently:

  1. Ran a migration adding a unique constraint on a table
  2. Generated two new entities of a couple very basic tables.

The handler I'm using isn't even using the new tables, so I don't know why this randomly broke. Anyone have any ideas? Or even some guidance on how to decipher that obscure error would be helpful.

top 6 comments
sorted by: hot top controversial new old
[-] hallettj@beehaw.org 6 points 1 year ago

Have you tried using the #[debug_handler] macro on get_all_armies? Without that macro handler errors don't tell you much more than "something isn't right".

Generally this kind of error indicates some type in the handler signature doesn't implement a necessary trait. Maybe you accidentally lost an automatically-derived trait like Send + Sync? The macro is the easiest way to check.

[-] nerdblood@programming.dev 4 points 1 year ago

Oh man, I didn't know debug_handler existed. Sure enough I had a missing derived attribute... not sure how but Serde serialize and deserialize were missing, so when I was trying to return Ok(Json(army)) it was failing. Thanks so much!

[-] hallettj@beehaw.org 1 points 1 year ago

You're welcome!

[-] mholiv@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

That looks like a Extension/State mismatch to me. Do your function arguments line up with any extensions or state you are bringing in?

[-] nerdblood@programming.dev 1 points 1 year ago

Thanks for the reply! I don't know what you mean by extensions, but the state is literally just the DB connection:

struct AppState { conn: DatabaseConnection, }

this post was submitted on 04 Sep 2023
16 points (94.4% liked)

Rust

5966 readers
14 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS