10.9 Оператор try
Исходная форма блока try выглядит следующим образом:
try body catch cleanup end_try_catch
где body и cleanup являются необязательными и могут содержать любые выражения или команды Octave. Операторы в cleanup выполняются только в случае возникновения ошибки в body.
При выполнении body не выводятся предупреждения или сообщения об ошибках. Если во время выполнения body произойдет ошибка, cleanup может использовать функции lasterr или lasterror для доступа к тексту сообщения, которое должно было быть выведено, а также к его идентификатору. Альтернативная форма,
try body catch err cleanup end_try_catch
автоматически сохранит вывод lasterror в структуре err. Подробнее об функциях lasterr и lasterror см. в разделе Ошибки и предупреждения.
© 1996–2022 The Octave Project Developers
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://docs.octave.org/v6.4.0/The-try-Statement.html