erigon-pulse/pedersen_hash/error_handling.h
primal_concrete_sledge c4805e0262
WIP: issue/issue-281-create_binding_to_pedersen_hash (#301)
* issue/issue-281-create_binding_to_pedersen_hash

* Add //nolint

* Add more nolints

* move nolint

* Remove nolit

* Add gcc install

* Upd .ci

* Remove staticcheck

* Add envs

* try to exclude pedersen_hash from test

* try to fix mac os build

* Add include for mac os

* Add include for mac os

* Fix runner_os

* remove test for macos

* Change restrictions

* restrict tests to ubuntu

* Try test windows

* Add build constraint
2022-02-10 14:47:28 +00:00

32 lines
802 B
C++

#ifndef STARKWARE_UTILS_ERROR_HANDLING_H_
#define STARKWARE_UTILS_ERROR_HANDLING_H_
#include <exception>
#include <string>
#include <utility>
namespace starkware {
class StarkwareException : public std::exception {
public:
explicit StarkwareException(std::string message) : message_(std::move(message)) {}
const char* what() const noexcept { return message_.c_str(); } // NOLINT
private:
std::string message_;
};
/*
We use "do {} while(false);" pattern to force the user to use ; after the macro.
*/
#define ASSERT(cond, msg) \
do { \
if (!(cond)) { \
throw StarkwareException(msg); \
} \
} while (false)
} // namespace starkware
#endif // STARKWARE_UTILS_ERROR_HANDLING_H_