mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
use std::exception as base class to z3_exception
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
1957b4d991
commit
92065462b4
60 changed files with 109 additions and 111 deletions
|
@ -19,24 +19,23 @@ Revision History:
|
|||
#include<iostream>
|
||||
#include "util/z3_exception.h"
|
||||
|
||||
class ex {
|
||||
class ex : public std::exception {
|
||||
public:
|
||||
virtual ~ex() = default;
|
||||
virtual char const * msg() const = 0;
|
||||
};
|
||||
|
||||
class ex1 : public ex {
|
||||
char const * m_msg;
|
||||
public:
|
||||
ex1(char const * m):m_msg(m) {}
|
||||
char const * msg() const override { return m_msg; }
|
||||
char const * what() const override { return m_msg; }
|
||||
};
|
||||
|
||||
class ex2 : public ex {
|
||||
std::string m_msg;
|
||||
public:
|
||||
ex2(char const * m):m_msg(m) {}
|
||||
char const * msg() const override { return m_msg.c_str(); }
|
||||
char const * what() const override { return m_msg.c_str(); }
|
||||
};
|
||||
|
||||
static void th() {
|
||||
|
@ -48,7 +47,7 @@ static void tst1() {
|
|||
th();
|
||||
}
|
||||
catch (ex & e) {
|
||||
std::cerr << e.msg() << "\n";
|
||||
std::cerr << e.what() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +56,7 @@ static void tst2() {
|
|||
throw default_exception(default_exception::fmt(), "Format %d %s", 12, "twelve");
|
||||
}
|
||||
catch (z3_exception& ex) {
|
||||
std::cerr << ex.msg() << "\n";
|
||||
std::cerr << ex.what() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void parse_cmd_line_args(int argc, char ** argv, bool& do_display_usage, bool& t
|
|||
gparams::set(key, value);
|
||||
}
|
||||
catch (z3_exception& ex) {
|
||||
std::cerr << ex.msg() << "\n";
|
||||
std::cerr << ex.what() << "\n";
|
||||
}
|
||||
}
|
||||
i++;
|
||||
|
|
|
@ -38,7 +38,7 @@ static void tst1() {
|
|||
}
|
||||
}
|
||||
catch (const z3_exception & ex) {
|
||||
std::cout << ex.msg() << "\n";
|
||||
std::cout << ex.what() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -926,6 +926,6 @@ void tst_udoc_relation() {
|
|||
tester.test1();
|
||||
}
|
||||
catch (z3_exception& ex) {
|
||||
std::cout << ex.msg() << "\n";
|
||||
std::cout << ex.what() << "\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ static void tst1() {
|
|||
v1.resize(i);
|
||||
}
|
||||
catch (z3_exception& e) {
|
||||
std::cout << e.msg() << "\n";
|
||||
std::cout << e.what() << "\n";
|
||||
break;
|
||||
}
|
||||
i *= 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue