Move error codes to errors.h

This commit is contained in:
Zach Hilman
2018-07-17 13:44:22 -04:00
parent 4367ba4fd9
commit f12b20036e
3 changed files with 6 additions and 3 deletions

View File

@@ -12,6 +12,8 @@ namespace ErrCodes {
enum { enum {
NotFound = 1, NotFound = 1,
SaveDataNotFound = 1002, SaveDataNotFound = 1002,
SdCardNotFound = 2001,
RomFSNotFound = 2520,
}; };
} }

View File

@@ -4,6 +4,7 @@
#include <boost/container/flat_map.hpp> #include <boost/container/flat_map.hpp>
#include "common/file_util.h" #include "common/file_util.h"
#include "core/file_sys/errors.h"
#include "core/file_sys/filesystem.h" #include "core/file_sys/filesystem.h"
#include "core/file_sys/savedata_factory.h" #include "core/file_sys/savedata_factory.h"
#include "core/file_sys/sdmc_factory.h" #include "core/file_sys/sdmc_factory.h"
@@ -58,7 +59,7 @@ ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenSaveData(
static_cast<u8>(space), SaveStructDebugInfo(save_struct)); static_cast<u8>(space), SaveStructDebugInfo(save_struct));
if (save_data_factory == nullptr) { if (save_data_factory == nullptr) {
return ResultCode(ErrorModule::FS, 1002); return ResultCode(ErrorModule::FS, FileSys::ErrCodes::SaveDataNotFound);
} }
return save_data_factory->Open(space, save_struct); return save_data_factory->Open(space, save_struct);
@@ -68,7 +69,7 @@ ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenSDMC() {
LOG_TRACE(Service_FS, "Opening SDMC"); LOG_TRACE(Service_FS, "Opening SDMC");
if (sdmc_factory == nullptr) { if (sdmc_factory == nullptr) {
return ResultCode(ErrorModule::FS, 2001); return ResultCode(ErrorModule::FS, FileSys::ErrCodes::SdCardNotFound);
} }
return sdmc_factory->Open(); return sdmc_factory->Open();

View File

@@ -602,7 +602,7 @@ void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
if (romfs.Failed()) { if (romfs.Failed()) {
LOG_CRITICAL(Service_FS, "no file system interface available!"); LOG_CRITICAL(Service_FS, "no file system interface available!");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultCode(ErrorModule::FS, 2520)); rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::RomFSNotFound));
return; return;
} }