From 49546c5269080f38d57365788eb2592bff8f6d10 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 9 Mar 2022 21:01:26 -0300 Subject: [PATCH] feat(build): print error context (#3644) --- .changes/tauri-build-default-anyhow-fmt.md | 5 +++++ core/tauri-build/src/lib.rs | 2 +- examples/api/src-tauri/build.rs | 2 +- examples/commands/src-tauri/build.rs | 2 +- examples/helloworld/src-tauri/build.rs | 2 +- examples/multiwindow/src-tauri/build.rs | 2 +- examples/navigation/src-tauri/build.rs | 2 +- examples/resources/src-tauri/build.rs | 2 +- examples/sidecar/src-tauri/build.rs | 2 +- examples/splashscreen/src-tauri/build.rs | 2 +- examples/state/src-tauri/build.rs | 2 +- examples/streaming/src-tauri/build.rs | 2 +- examples/tauri-dynamic-lib/src-tauri/build.rs | 2 +- examples/updater/src-tauri/build.rs | 2 +- tooling/bench/tests/cpu_intensive/src-tauri/build.rs | 2 +- tooling/bench/tests/files_transfer/src-tauri/build.rs | 2 +- tooling/bench/tests/helloworld/src-tauri/build.rs | 2 +- 17 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 .changes/tauri-build-default-anyhow-fmt.md diff --git a/.changes/tauri-build-default-anyhow-fmt.md b/.changes/tauri-build-default-anyhow-fmt.md new file mode 100644 index 000000000..0fda6ac66 --- /dev/null +++ b/.changes/tauri-build-default-anyhow-fmt.md @@ -0,0 +1,5 @@ +--- +"tauri-build": patch +--- + +Print error context on the `build` panic. diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 0d891ad1d..4aaa3218c 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -143,7 +143,7 @@ impl Attributes { /// This is typically desirable when running inside a build script; see [`try_build`] for no panics. pub fn build() { if let Err(error) = try_build(Attributes::default()) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/api/src-tauri/build.rs b/examples/api/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/api/src-tauri/build.rs +++ b/examples/api/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/commands/src-tauri/build.rs b/examples/commands/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/commands/src-tauri/build.rs +++ b/examples/commands/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/helloworld/src-tauri/build.rs b/examples/helloworld/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/helloworld/src-tauri/build.rs +++ b/examples/helloworld/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/multiwindow/src-tauri/build.rs b/examples/multiwindow/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/multiwindow/src-tauri/build.rs +++ b/examples/multiwindow/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/navigation/src-tauri/build.rs b/examples/navigation/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/navigation/src-tauri/build.rs +++ b/examples/navigation/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/resources/src-tauri/build.rs b/examples/resources/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/resources/src-tauri/build.rs +++ b/examples/resources/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/sidecar/src-tauri/build.rs b/examples/sidecar/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/sidecar/src-tauri/build.rs +++ b/examples/sidecar/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/splashscreen/src-tauri/build.rs b/examples/splashscreen/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/splashscreen/src-tauri/build.rs +++ b/examples/splashscreen/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/state/src-tauri/build.rs b/examples/state/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/state/src-tauri/build.rs +++ b/examples/state/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/streaming/src-tauri/build.rs b/examples/streaming/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/streaming/src-tauri/build.rs +++ b/examples/streaming/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/tauri-dynamic-lib/src-tauri/build.rs b/examples/tauri-dynamic-lib/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/tauri-dynamic-lib/src-tauri/build.rs +++ b/examples/tauri-dynamic-lib/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/examples/updater/src-tauri/build.rs b/examples/updater/src-tauri/build.rs index 2ad1cb4e6..017a75d00 100644 --- a/examples/updater/src-tauri/build.rs +++ b/examples/updater/src-tauri/build.rs @@ -9,6 +9,6 @@ fn main() { Attributes::new() .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), ) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/tooling/bench/tests/cpu_intensive/src-tauri/build.rs b/tooling/bench/tests/cpu_intensive/src-tauri/build.rs index b87417ddd..ecfc77b39 100644 --- a/tooling/bench/tests/cpu_intensive/src-tauri/build.rs +++ b/tooling/bench/tests/cpu_intensive/src-tauri/build.rs @@ -8,6 +8,6 @@ fn main() { if let Err(error) = try_build(Attributes::new().windows_attributes( WindowsAttributes::new().window_icon_path("../../../../../examples/.icons/icon.ico"), )) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/tooling/bench/tests/files_transfer/src-tauri/build.rs b/tooling/bench/tests/files_transfer/src-tauri/build.rs index b87417ddd..ecfc77b39 100644 --- a/tooling/bench/tests/files_transfer/src-tauri/build.rs +++ b/tooling/bench/tests/files_transfer/src-tauri/build.rs @@ -8,6 +8,6 @@ fn main() { if let Err(error) = try_build(Attributes::new().windows_attributes( WindowsAttributes::new().window_icon_path("../../../../../examples/.icons/icon.ico"), )) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } } diff --git a/tooling/bench/tests/helloworld/src-tauri/build.rs b/tooling/bench/tests/helloworld/src-tauri/build.rs index b87417ddd..ecfc77b39 100644 --- a/tooling/bench/tests/helloworld/src-tauri/build.rs +++ b/tooling/bench/tests/helloworld/src-tauri/build.rs @@ -8,6 +8,6 @@ fn main() { if let Err(error) = try_build(Attributes::new().windows_attributes( WindowsAttributes::new().window_icon_path("../../../../../examples/.icons/icon.ico"), )) { - panic!("error found during tauri-build: {}", error); + panic!("error found during tauri-build: {:#?}", error); } }