Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cdadd1

Browse files
committed
Replaced assert_throw with assert_fatal
1 parent 85336a9 commit 7cdadd1

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

buildcc/lib/target/src/generator/task.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void Generator::GenerateTask() {
5252
auto run_command = [this](const std::string &command) {
5353
try {
5454
bool success = env::Command::Execute(command);
55-
env::assert_throw(success, fmt::format("{} failed", command));
55+
env::assert_fatal(success, fmt::format("{} failed", command));
5656
} catch (...) {
5757
std::lock_guard<std::mutex> guard(task_state_mutex_);
5858
task_state_ = env::TaskState::FAILURE;
@@ -104,7 +104,7 @@ void Generator::GenerateTask() {
104104
if (dirty_) {
105105
try {
106106
serialization_.UpdateStore(user_);
107-
env::assert_throw(serialization_.StoreToFile(),
107+
env::assert_fatal(serialization_.StoreToFile(),
108108
fmt::format("Store failed for {}", name_));
109109
} catch (...) {
110110
task_state_ = env::TaskState::FAILURE;

buildcc/lib/target/src/target/friend/compile_pch.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void AggregateToFile(const fs::path &filename,
5454
});
5555
bool success = buildcc::env::save_file(
5656
buildcc::path_as_string(filename).c_str(), constructed_output, false);
57-
buildcc::env::assert_throw(success, "Could not save pch file");
57+
buildcc::env::assert_fatal(success, "Could not save pch file");
5858
}
5959

6060
} // namespace
@@ -108,10 +108,10 @@ void CompilePch::BuildCompile() {
108108
const std::string p = fmt::format("{}", source_path_);
109109
const bool save =
110110
env::save_file(p.c_str(), {"//Generated by BuildCC"}, false);
111-
env::assert_throw(save, fmt::format("Could not save {}", p));
111+
env::assert_fatal(save, fmt::format("Could not save {}", p));
112112
}
113113
bool success = env::Command::Execute(command_);
114-
env::assert_throw(success, "Failed to compile pch");
114+
env::assert_fatal(success, "Failed to compile pch");
115115
}
116116
}
117117

buildcc/lib/target/src/target/friend/link_target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void LinkTarget::BuildLink() {
9898

9999
if (target_.dirty_) {
100100
bool success = env::Command::Execute(command_);
101-
env::assert_throw(success, "Failed to link target");
101+
env::assert_fatal(success, "Failed to link target");
102102
target_.serialization_.UpdateTargetCompiled();
103103
}
104104
}

buildcc/lib/target/src/target/tasks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void CompileObject::Task() {
124124
try {
125125
bool success = env::Command::Execute(
126126
GetObjectData(s.GetPathname()).command);
127-
env::assert_throw(success, "Could not compile source");
127+
env::assert_fatal(success, "Could not compile source");
128128
target_.serialization_.AddSource(s);
129129
} catch (...) {
130130
target_.SetTaskStateFailure();
@@ -170,7 +170,7 @@ void Target::EndTask() {
170170
if (dirty_) {
171171
try {
172172
serialization_.UpdateStore(user_);
173-
env::assert_throw(serialization_.StoreToFile(),
173+
env::assert_fatal(serialization_.StoreToFile(),
174174
fmt::format("Store failed for {}", GetName()));
175175
state_.BuildCompleted();
176176
} catch (...) {

buildcc/schema/include/schema/path.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <unordered_set>
2626

2727
// Env
28-
#include "env/assert_throw.h"
28+
#include "env/assert_fatal.h"
2929

3030
// Third party
3131
#include "fmt/format.h"
@@ -51,7 +51,7 @@ class Path {
5151
std::filesystem::last_write_time(pathname, errcode)
5252
.time_since_epoch()
5353
.count();
54-
env::assert_throw(errcode.value() == 0,
54+
env::assert_fatal(errcode.value() == 0,
5555
fmt::format("{} not found", pathname));
5656

5757
return Path(pathname, last_write_timestamp);

0 commit comments

Comments
 (0)