Odonno / surrealdb-migrations

An awesome SurrealDB migration tool, with a user-friendly CLI and a versatile Rust library that enables seamless integration into any project.
https://crates.io/crates/surrealdb-migrations
MIT License
210 stars 16 forks source link

Improved error log with failed transactions #44

Closed unidesigner closed 9 months ago

unidesigner commented 1 year ago

When a migration fails with

Error: The query was not executed due to a failed transaction

Caused by:
    The query was not executed due to a failed transaction

I'd like to see a more verbose error message what the reason was for the failed transaction. Would it be possible to display this information?

Odonno commented 1 year ago

Yes, I suppose we can go inside the surrealdb query response and extract the error message.

Great idea.

unidesigner commented 1 year ago

That would be fantastic! Right now, it's quite cumbersome to rerun the migration file manually and parse the errors.

turbohz commented 10 months ago

AFAIK, there's no error message there to extract.

See https://github.com/surrealdb/surrealdb/issues/2888

But printing the whole query of the failed transaction would definitely help.

Odonno commented 9 months ago

I have released the v1.0.1 crate which should now display the list of error messages when a migration fails.

unidesigner commented 9 months ago

@Odonno: I tried to compile v1.0.1. create with cargo install surrealdb-migrations@1.0.1 but ran into a compile error

error[E0658]: use of unstable library feature 'build_hasher_simple_hash_one'
    --> /home/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ordered-multimap-0.7.1/src/list_ordered_multimap.rs:3288:34
     |
3288 |     let hash = self.build_hasher.hash_one(key);
     |                                  ^^^^^^^^
     |
     = note: see issue #86161 <https://github.com/rust-lang/rust/issues/86161> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `ordered-multimap` (lib) due to 27 previous errors

Any idea how to fix this?

Odonno commented 9 months ago

No problem on my end. What is your version of Rust? Can you try to upgrade to the latest version of Rust and see if the error disappear?

unidesigner commented 9 months ago

Updating Rust fixed the error. Thanks.