IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
irquery.m
Go to the documentation of this file.
1 %>@ingroup ioio
2 %>@file
3 %>@brief Wraps over mYm to retry at lost connection errors
4 function r = irquery(varargin)
5 num_tries = 5;
6 i = 0;
7 flag_exit = 0;
8 while 1
9  try
10  r = mym(varargin{:});
11  flag_exit = 1;
12  catch ME
13  irverbose(sprintf('Failed query (attempt %d/%d): ``%s``', i+1, num_tries, ME.message), 3);
14  if i >= num_tries-1
15  irverbose(sprintf('irquery() gave up after %d tries', i+1), 3);
16  rethrow(ME);
17  end;
18  % Recovers from lost connection
19  if any(strfind(ME.message, 'gone away')) || any(strfind(ME.message, 'ost connection')) || any(strfind(ME.message, 'ot connected'))
21  end;
22  end;
23  i = i+1;
24  if flag_exit
25  break;
26  end;
27 end;
function irverbose(in s, in level)
function irquery(in varargin)
function assert_connected_to_cells()