lib/file.cpp:Fix exception warnings

Soda
Shwoomple 2022-09-30 22:41:55 +05:30
parent 09503d3dc7
commit c204aa7d76
1 changed files with 4 additions and 4 deletions

View File

@ -28,7 +28,7 @@ File::File(std::string path, char mode, uint64_t cursorPosition): mode(mode), pa
try{
std::filesystem::path filePath = path;
this->size = ErrorOr<uint64_t>(std::filesystem::file_size(filePath));
}catch(std::exception e){
}catch(std::exception& e){
this->size = ErrorOr<uint64_t>(true, ErrorCodes::FILE_NOT_FOUND);
}
@ -88,7 +88,7 @@ void File::open(){
try{
std::filesystem::path filePath = this->path;
this->size = ErrorOr<uint64_t>(std::filesystem::file_size(filePath));
}catch(std::exception e){
}catch(std::exception& e){
this->size = ErrorOr<uint64_t>(true, ErrorCodes::FILE_NOT_FOUND);
}
}
@ -114,7 +114,7 @@ ErrorOr<uint8_t> File::readByte(){
try{
this->fileStream.read(byte, 1);
delete byte;
}catch(std::exception e){
}catch(std::exception& e){
return ErrorOr<uint8_t>(true, ErrorCodes::FILE_READ_FAILED);
}
return ErrorOr<uint8_t>((uint8_t) *byte);
@ -136,7 +136,7 @@ ErrorOr<std::vector<uint8_t>> File::read(uint64_t bytes){
data.push_back((uint8_t) buffer[i]);
}
delete[] buffer;
}catch(std::exception e){
}catch(std::exception& e){
return ErrorOr<std::vector<uint8_t>>(true, ErrorCodes::FILE_READ_FAILED);
}
return ErrorOr<std::vector<uint8_t>>(data);