mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
bundled translation: Better error reporting
forward the error up the stack instead of panicking while producing the llr
This commit is contained in:
parent
3f8084cdc0
commit
73b549a42c
6 changed files with 21 additions and 13 deletions
|
@ -459,7 +459,8 @@ pub fn compile_with_output(
|
|||
let output_file =
|
||||
std::fs::File::create(&output_rust_file_path).map_err(CompileError::SaveError)?;
|
||||
let mut code_formatter = CodeFormatter::new(BufWriter::new(output_file));
|
||||
let generated = i_slint_compiler::generator::rust::generate(&doc, &loader.compiler_config);
|
||||
let generated = i_slint_compiler::generator::rust::generate(&doc, &loader.compiler_config)
|
||||
.map_err(|e| CompileError::CompileError(vec![e.to_string()]))?;
|
||||
|
||||
let mut dependencies: Vec<std::path::PathBuf> = Vec::new();
|
||||
|
||||
|
|
|
@ -415,7 +415,11 @@ pub fn slint(stream: TokenStream) -> TokenStream {
|
|||
return diag.report_macro_diagnostic(&tokens);
|
||||
}
|
||||
|
||||
let mut result = generator::rust::generate(&root_component, &loader.compiler_config);
|
||||
let mut result = generator::rust::generate(&root_component, &loader.compiler_config)
|
||||
.unwrap_or_else(|e| {
|
||||
let e_str = e.to_string();
|
||||
quote!(compile_error!(#e_str))
|
||||
});
|
||||
|
||||
// Make sure to recompile if any of the external files changes
|
||||
let reload = diag
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue