3
0
Fork 0
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:
Nikolaj Bjorner 2024-11-04 11:08:15 -08:00
parent 1957b4d991
commit 92065462b4
60 changed files with 109 additions and 111 deletions

View file

@ -29,7 +29,7 @@ Revision History:
class overflow_exception : public z3_exception {
char const* msg() const override { return "checked_int64 overflow/underflow"; }
char const* what() const override { return "checked_int64 overflow/underflow"; }
};
template<bool CHECK>
@ -364,4 +364,4 @@ inline checked_int64<CHECK> gcd(checked_int64<CHECK> const& a, checked_int64<CHE
lasty = temp;
}
return _a;
}
}

View file

@ -182,15 +182,15 @@ public:
static bool field() { return true; }
class exception : public z3_exception {
char const * msg() const override { return "multi-precision floating point (mpff) exception"; }
char const * what() const override { return "multi-precision floating point (mpff) exception"; }
};
class overflow_exception : public exception {
char const * msg() const override { return "multi-precision floating point (mpff) overflow"; }
char const * what() const override { return "multi-precision floating point (mpff) overflow"; }
};
class div0_exception : public exception {
char const * msg() const override { return "multi-precision floating point (mpff) division by zero"; }
char const * what() const override { return "multi-precision floating point (mpff) division by zero"; }
};
mpff_manager(unsigned prec = 2, unsigned initial_capacity = 1024);

View file

@ -129,15 +129,15 @@ public:
static bool field() { return true; }
class exception : public z3_exception {
char const * msg() const override { return "multi-precision fixed point (mpfx) exception"; }
char const * what() const override { return "multi-precision fixed point (mpfx) exception"; }
};
class overflow_exception : public exception {
char const * msg() const override { return "multi-precision fixed point (mpfx) overflow"; }
char const * what() const override { return "multi-precision fixed point (mpfx) overflow"; }
};
class div0_exception : public exception {
char const * msg() const override { return "multi-precision fixed point (mpfx) division by zero"; }
char const * what() const override { return "multi-precision fixed point (mpfx) division by zero"; }
};
mpfx_manager(unsigned int_sz = 2, unsigned frac_sz = 1, unsigned initial_capacity = 1024);

View file

@ -35,7 +35,7 @@ z3_error::z3_error(unsigned error_code):m_error_code(error_code) {
SASSERT(error_code != 0);
}
char const * z3_error::msg() const {
char const * z3_error::what() const {
switch (m_error_code) {
case ERR_MEMOUT: return "out of memory";
case ERR_TIMEOUT: return "timeout";
@ -67,6 +67,6 @@ default_exception::default_exception(fmt, char const* msg, ...) {
m_msg = out.str();
}
char const * default_exception::msg() const {
char const * default_exception::what() const {
return m_msg.c_str();
}

View file

@ -19,11 +19,11 @@ Notes:
#pragma once
#include<string>
#include<exception>
class z3_exception {
class z3_exception : public std::exception {
public:
virtual ~z3_exception() = default;
virtual char const * msg() const = 0;
virtual unsigned error_code() const;
bool has_error_code() const;
};
@ -32,7 +32,7 @@ class z3_error : public z3_exception {
unsigned m_error_code;
public:
z3_error(unsigned error_code);
char const * msg() const override;
char const * what() const override;
unsigned error_code() const override;
};
@ -42,6 +42,6 @@ public:
struct fmt {};
default_exception(std::string && msg) : m_msg(std::move(msg)) {}
default_exception(fmt, char const* msg, ...);
char const * msg() const override;
char const * what() const override;
};