From af513996e040b613c9a852993be46385b14c89bf Mon Sep 17 00:00:00 2001 From: FusionBolt <59008347+FusionBolt@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:00:58 +0800 Subject: [PATCH] Fix Catch for Compile (#1137) * fix bug * fix * update * update * resolve review * update * fix try catch --- src/Nncase.Studio/ViewModels/CompileViewModel.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Nncase.Studio/ViewModels/CompileViewModel.cs b/src/Nncase.Studio/ViewModels/CompileViewModel.cs index 918bcf221..8977f7313 100644 --- a/src/Nncase.Studio/ViewModels/CompileViewModel.cs +++ b/src/Nncase.Studio/ViewModels/CompileViewModel.cs @@ -101,12 +101,17 @@ public async Task Compile() { await Task.Run(async () => await compiler.CompileAsync(progress, _cts.Token)); } - catch (Exception) + catch (OperationCanceledException) { Context.OpenDialog("Compile has been cancel"); ProgressBarValue = 0; return; } + catch (Exception exp) + { + Context.OpenDialog($"Error:{exp.Message}"); + return; + } using (var os = File.OpenWrite(KmodelPath)) {