Remove the chrono crate from cli as it was unused and pinning our version of serde.
Update serde & friends to version 1.0.
Use serde_json::from_reader where possible to avoid reading the whole file to memory in a string before parsing.
Simplify some Path handling when packaging a project by comparing PathBufs instead of building strings.
Improve error handling using chain_err - note that the errors will capture the original error and wrap it, outputting for example, trying to script a dacpac that doesn't exist, where the error comes from std::fs:
justinlatimer$ psqlpackage script --source simple.dacpac --target '...' --profile publish_profile.json --out simple.sql
Error encountered during script command:
Error: Couldn't read package file: ../out/simple.dacpac
Caused by: No such file or directory (os error 2)
Or trying to script a corrupt dacpac, where the error comes from zip::ZipArchive:
justinlatimer$ psqlpackage script --source simple.dacpac --target '...' --profile publish_profile.json --out simple.sql
Error encountered during script command:
Error: Couldn't unarchive package file: ../out/simple.dacpac
Caused by: Invalid Zip archive: Could not find central directory end
At the moment, the error handling is a bit noisy, I've got a few ideas to reduce line length in a future PR.
chrono
crate fromcli
as it was unused and pinning our version ofserde
.serde
& friends to version 1.0.serde_json::from_reader
where possible to avoid reading the whole file to memory in a string before parsing.Path
handling when packaging a project by comparingPathBuf
s instead of building strings.chain_err
- note that the errors will capture the original error and wrap it, outputting for example, trying to script a dacpac that doesn't exist, where the error comes fromstd::fs
:Or trying to script a corrupt dacpac, where the error comes from
zip::ZipArchive
:At the moment, the error handling is a bit noisy, I've got a few ideas to reduce line length in a future PR.