Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1844


Ignore:
Timestamp:
05/18/09 18:03:53 (16 years ago)
Author:
epitzer
Message:

Don't crash application if exceptions occur during load/save (#603)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.3/MainForm.cs

    r1529 r1844  
    155155      try {
    156156        task.storable = PersistenceManager.Load(task.filename);
    157       } catch(FileNotFoundException fileNotFoundEx) {
     157      } catch (FileNotFoundException fileNotFoundEx) {
    158158        MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe file or plugin \"" + fileNotFoundEx.FileName + "\" is not available.\nPlease make sure you have all necessary plugins installed.",
    159159          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    160       } catch(TypeLoadException typeLoadEx) {
    161         MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe type \"" + typeLoadEx.TypeName+ "\" is not available.\nPlease make sure that you have the correct version the plugin installed.",
     160      } catch (TypeLoadException typeLoadEx) {
     161        MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe type \"" + typeLoadEx.TypeName + "\" is not available.\nPlease make sure that you have the correct version the plugin installed.",
     162          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     163      } catch (Exception e) {
     164        MessageBox.Show(String.Format(
     165          "Sorry couldn't open file \"{0}\".\n The following exception occurred: {1}",
     166          task.filename, e.ToString()),
    162167          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    163168      }
     
    205210        Save(form);
    206211      }
     212
    207213    }
    208214    private void AsynchronousSave(object state) {
    209215      Task task = (Task)state;
    210       PersistenceManager.Save(task.storable, task.filename);
     216      try {
     217        PersistenceManager.Save(task.storable, task.filename);
     218      } catch (Exception e) {
     219        MessageBox.Show(String.Format(
     220          "Sorry couldn't open file \"{0}\".\n The following exception occurred: {1}",
     221          task.filename, e.ToString()),
     222          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     223      }
    211224      SaveFinished(task);
    212225    }
Note: See TracChangeset for help on using the changeset viewer.