sampsapursiainen / zeffiro_interface

Interface for using finite elements in inverse problems with complex domains
GNU General Public License v3.0
24 stars 15 forks source link

Suggestion: show errors #203

Open mshavliuk opened 1 year ago

mshavliuk commented 1 year ago

Problem

At the moment, all of the validation errors in the app get printed to the Matlab command window and may be missed, although they should bring user's attention since they are the direct consequence of their actions and do not allow to continue the initiated operations.

Example:

  1. User starts Zeffiro Interface and loads Multicompartment head project
  2. Open ES Workbench, set desired parameters
  3. Click "Find currents"
  4. Confirm calculations

It looks like nothing happens at this point. Meanwhile there is an error printed to stderr:

Error using zef_ES_find_currents (line 108)
ZI: No discretized sources found. Perhaps you forgot to calculate or load them...?

Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 427)
Error while evaluating Button PrivateButtonPushedFcn.

So at the end, asking user if they absolutely want to perform computations attracts much more attention than the fact, that they cannot be performed due to an absence of tES lead field.

Suggestion

Using builtin tools for showing errors in GUI:

errordlg(sprintf('Error: %s', exception.message), 'Error');
Screenshot 2023-05-08 at 10 44 57

This would also make it possible to use ZI as a standalone app, which otherwise is impossible due to using command window as a communication channel.