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
|
#pragma once
|
||||||
|
#include <cassert>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <shared_mutex>
|
#include <shared_mutex>
|
||||||
#include <parallel-hashmap/parallel_hashmap/phmap.h>
|
#include <parallel-hashmap/parallel_hashmap/phmap.h>
|
||||||
#include "bank_resp.h"
|
#include "bank_resp.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
|
||||||
|
|
||||||
#if (CONSERVATIVE_DISK_SAVE && MAX_LOG_SIZE < 0) && !MULTI_THREADED
|
#if (CONSERVATIVE_DISK_SAVE && MAX_LOG_SIZE < 0) && !MULTI_THREADED
|
||||||
#include "change_flag.h"
|
#include "change_flag.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -320,16 +320,13 @@ const char *Bank::Save()
|
||||||
}
|
}
|
||||||
FBE::bank_dom::GlobalFinalModel writer;
|
FBE::bank_dom::GlobalFinalModel writer;
|
||||||
writer.serialize(users_copy);
|
writer.serialize(users_copy);
|
||||||
if (!writer.verify())
|
assert(writer.verify() && "Data is corrupted!");
|
||||||
{
|
|
||||||
throw std::invalid_argument("Data is corrupted\n");
|
|
||||||
}
|
|
||||||
const FBE::FBEBuffer &write_buffer = writer.buffer();
|
const FBE::FBEBuffer &write_buffer = writer.buffer();
|
||||||
users_save.write((char *)write_buffer.data(), write_buffer.size());
|
users_save.write((char *)write_buffer.data(), write_buffer.size());
|
||||||
users_save.close();
|
users_save.close();
|
||||||
if (!users_save.good())
|
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
|
#if CONSERVATIVE_DISK_SAVE
|
||||||
save_flag.SetChangesOff();
|
save_flag.SetChangesOff();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue