mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 15:28:58 -04:00
improve warnings (#770)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include "common/util/assert.h"
|
||||
|
||||
#include "third-party/fmt/core.h"
|
||||
@@ -15,6 +16,13 @@ class DecompWarnings {
|
||||
warning(Warning::Kind::GENERAL, str, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void warn_and_throw(const std::string& str, Args&&... args) {
|
||||
auto text = fmt::format(str, std::forward<Args>(args)...);
|
||||
warning(Warning::Kind::GENERAL, text);
|
||||
throw std::runtime_error(text);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void expression_build_warning(const std::string& str, Args&&... args) {
|
||||
warning(Warning::Kind::EXPR_BUILD_FAILED, str, std::forward<Args>(args)...);
|
||||
|
||||
Reference in New Issue
Block a user