Added error handling
This commit is contained in:
@ -21,11 +21,11 @@ namespace fsh {
|
||||
std::string filename = args.get<std::string>(0).value();
|
||||
|
||||
if(!std::ifstream(filename, std::ios_base::in)) {
|
||||
throw std::runtime_error("File does not exist");
|
||||
throw util::FileExistsError();
|
||||
}
|
||||
|
||||
if(!std::ofstream(filename, std::ios_base::out)) {
|
||||
throw std::runtime_error("Failed to truncate");
|
||||
throw util::CmdError("Failed to truncate");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user