mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 13:53:11 -07:00
Update EquationViewModel.cpp error handling
Catching unhandled exceptions instead of crashing
This commit is contained in:
parent
eb0324f1a0
commit
277097d9f6
1 changed files with 48 additions and 40 deletions
|
@ -51,6 +51,8 @@ namespace CalculatorApp::ViewModel
|
|||
}
|
||||
|
||||
void EquationViewModel::PopulateKeyGraphFeatures(KeyGraphFeaturesInfo ^ graphEquation)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (graphEquation->AnalysisError != 0)
|
||||
{
|
||||
|
@ -95,6 +97,12 @@ namespace CalculatorApp::ViewModel
|
|||
|
||||
AnalysisErrorVisible = false;
|
||||
}
|
||||
catch (Exception^ ex)
|
||||
{
|
||||
AnalysisErrorVisible = true;
|
||||
AnalysisErrorString = "Invalid input: " + ex->Message;
|
||||
}
|
||||
}
|
||||
|
||||
void EquationViewModel::AddKeyGraphFeature(String ^ title, String ^ expression, String ^ errorString)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue