mirror of
https://github.com/Kindelia/Kind2.git
synced 2024-09-11 07:15:45 +03:00
merge: pull request #565 from HigherOrderCO/564-new-panic-hook-for-the-language
Panic hook
This commit is contained in:
commit
2d0cda4faa
@ -1,3 +1,5 @@
|
|||||||
|
#![feature(panic_info_message)]
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
@ -8,6 +10,7 @@ use kind_driver::session::Session;
|
|||||||
|
|
||||||
use kind_report::data::{Diagnostic, FileCache, Log, Severity};
|
use kind_report::data::{Diagnostic, FileCache, Log, Severity};
|
||||||
use kind_report::RenderConfig;
|
use kind_report::RenderConfig;
|
||||||
|
use std::panic;
|
||||||
|
|
||||||
use kind_driver as driver;
|
use kind_driver as driver;
|
||||||
|
|
||||||
@ -354,6 +357,13 @@ pub fn run_cli(config: Cli) -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
||||||
|
panic::set_hook(Box::new(|e| {
|
||||||
|
println!("\n[Error]: internal compiler error '{:?}' at {}", e.message().unwrap(), e.location().unwrap());
|
||||||
|
println!("Please submit a full report about this error at: https://github.com/HigherOrderCO/Kind/issues/new");
|
||||||
|
println!("It would help us a lot :)\n");
|
||||||
|
}));
|
||||||
|
|
||||||
match run_cli(Cli::parse()) {
|
match run_cli(Cli::parse()) {
|
||||||
Ok(_) => std::process::exit(0),
|
Ok(_) => std::process::exit(0),
|
||||||
Err(_) => std::process::exit(1),
|
Err(_) => std::process::exit(1),
|
||||||
|
Loading…
Reference in New Issue
Block a user