Skip to content
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

Better io error message for migrate macro #2899

Closed
wants to merge 1 commit into from

Conversation

Vrajs16
Copy link
Contributor

@Vrajs16 Vrajs16 commented Nov 25, 2023

closes #1660

match migrate::expand_migrator_from_lit_dir(input) {
Ok(ts) => ts.into(),
Err(e) => {
if let Some(parse_err) = e.downcast_ref::<syn::Error>() {
parse_err.to_compile_error().into()
} else if let Some(io_err) = e.downcast_ref::<std::io::Error>() {
let msg = format!("Migrations folder not found at '{path}'. Check if the folder exists.\nError: '{io_err}'");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not correct to assume that "not found" is the only possible I/O error here. This message would be rather misleading in any other case.

You should at least check the error kind: https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NotFound

@abonander
Copy link
Collaborator

@Vrajs16 are you planning on coming back to this?

@abonander abonander mentioned this pull request Mar 6, 2024
2 tasks
@abonander
Copy link
Collaborator

Closing due to inactivity. I'm working on a better version of this in #3098

@abonander abonander closed this Mar 6, 2024
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.

sqlx::migrate!() No such file or directory (os error 2)
2 participants