Add compiler version & system information to panic error message

So that we stop constantly asking people about it.
This commit is contained in:
KtorZ 2023-10-06 14:45:25 +02:00
parent 524d0dadf5
commit a524836c94
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
3 changed files with 18 additions and 3 deletions

View File

@ -5,6 +5,7 @@
### Added ### Added
- **aiken-project**: The `plutus.json` blueprint now contains a `compiler.name` and `compiler.version` fields. - **aiken-project**: The `plutus.json` blueprint now contains a `compiler.name` and `compiler.version` fields.
- **aiken-prokect**: Add compiler and system information to panic error report.
### Changed ### Changed

View File

@ -132,3 +132,15 @@ pub fn compiler_version(include_commit_hash: bool) -> String {
format!("v{}", built_info::PKG_VERSION_MAJOR,) format!("v{}", built_info::PKG_VERSION_MAJOR,)
} }
} }
pub fn compiler_info() -> String {
format!(
r#"
Operating System: {}
Architecture: {}
Version: {}"#,
built_info::CFG_OS,
built_info::CFG_TARGET_ARCH,
compiler_version(true),
)
}

View File

@ -4,6 +4,7 @@ use aiken::cmd::{
packages::{self, add}, packages::{self, add},
tx, uplc, Cmd, tx, uplc, Cmd,
}; };
use aiken_project::{config, pretty};
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
@ -54,18 +55,19 @@ fn panic_handler() {
let error_message = indoc::formatdoc! { let error_message = indoc::formatdoc! {
r#"{fatal} r#"{fatal}
Whoops! You found a bug in the Aiken compiler. Whoops! You found a bug in the Aiken compiler.
Please report this error at https://github.com/aiken-lang/aiken/issues/new. Please report this error at https://github.com/aiken-lang/aiken/issues/new.
In your bug report please provide the information below and if possible the code In your bug report please provide the information below and if possible the code
that produced it. that produced it.
{info}
{location}{message}"#, {location}{message}"#,
info = config::compiler_info(),
fatal = "aiken::fatal::error".red().bold(), fatal = "aiken::fatal::error".red().bold(),
location = location.purple(), location = location.purple(),
}; };
println!("{error_message}") println!("\n{}", pretty::indent(&error_message, 3));
})); }));
} }