mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 12:37:08 +11:00
✨ improved errors
This commit is contained in:
parent
348c3b6e12
commit
c083d78ac1
2 changed files with 4 additions and 5 deletions
|
|
@ -1,10 +1,12 @@
|
|||
#pragma once
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
#include <shared_mutex>
|
||||
#include <parallel-hashmap/parallel_hashmap/phmap.h>
|
||||
#include "bank_resp.h"
|
||||
#include "user.h"
|
||||
|
||||
|
||||
#if (CONSERVATIVE_DISK_SAVE && MAX_LOG_SIZE < 0) && !MULTI_THREADED
|
||||
#include "change_flag.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -320,16 +320,13 @@ const char *Bank::Save()
|
|||
}
|
||||
FBE::bank_dom::GlobalFinalModel writer;
|
||||
writer.serialize(users_copy);
|
||||
if (!writer.verify())
|
||||
{
|
||||
throw std::invalid_argument("Data is corrupted\n");
|
||||
}
|
||||
assert(writer.verify() && "Data is corrupted!");
|
||||
const FBE::FBEBuffer &write_buffer = writer.buffer();
|
||||
users_save.write((char *)write_buffer.data(), write_buffer.size());
|
||||
users_save.close();
|
||||
if (!users_save.good())
|
||||
{
|
||||
throw std::invalid_argument("Error occurred at writing\n");
|
||||
throw std::invalid_argument("Error occurred at writing to save file\n");
|
||||
}
|
||||
#if CONSERVATIVE_DISK_SAVE
|
||||
save_flag.SetChangesOff();
|
||||
|
|
|
|||
Loading…
Reference in a new issue