Skip to content

Commit

Permalink
Merge pull request #3196 from prisma/me/better-error-on-sqlite-trunca…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
tomhoule committed Sep 16, 2022
2 parents cf674bd + 51e9120 commit 4124c5c
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -253,7 +253,13 @@ impl SqlFlavour for SqliteFlavour {
connection.raw_cmd("PRAGMA main.quick_check")?;

tracing::debug!("Truncating {:?}", file_path);
std::fs::File::create(file_path).expect("failed to truncate sqlite file");

std::fs::File::create(file_path).map_err(|io_error| {
ConnectorError::from_source(
io_error,
"Failed to truncate sqlite file. Please check that you have write permissions on the directory.",
)
})?;

acquire_lock(connection)?;

Expand Down

0 comments on commit 4124c5c

Please sign in to comment.