octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59592] using std::exception to catch errors


From: anonymous
Subject: [Octave-bug-tracker] [bug #59592] using std::exception to catch errors
Date: Wed, 2 Dec 2020 03:02:32 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:68.9) Gecko/20100101 Goanna/4.6 Firefox/68.9 Mypal/28.14.2

URL:
  <https://savannah.gnu.org/bugs/?59592>

                 Summary: using std::exception to catch errors
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Wed 02 Dec 2020 08:02:30 AM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Regression
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.1.0
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

Thankfully in Octave 6.1 all exception types are refactored to inherit
,directly or indirectly, from std::exception but it may need some modification
to be used in the following situation. Consider the following example:


try
  {
    error ("some error");
  }
catch (const std::exception& e)
  {
    std::cout << "can be caught with std::exception\n" ;
  }
catch (...)
  {
    std::cout << "cannot be caught with std::exception\n" ;
  }


Someone may want to throw an error and use std::exception to catch it but
currently it is impossible because the exception liboctave/util/quit.h is
defined as :


class execution_exception : std::runtime_error


This StackOverflow post https://stackoverflow.com/a/8152888/6579744 recommends
to define it as


class execution_exception : public std::runtime_error


Thanks!




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59592>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]