mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-17 15:06:49 +00:00
Updated error handling
This commit is contained in:
parent
c78ff8fce1
commit
7f68f9b91f
@ -61,8 +61,7 @@ enum PbOperation {
|
||||
RESERVE = 14;
|
||||
// Create an image file. The image file must not yet exist.
|
||||
// PbCommand.params(0) contains the filename, PbCommand.params(1) contains the file size in bytes.
|
||||
// PbCommand.params(2) is optional (default is false) and controls the file permissions.
|
||||
// If "true" (case-insensitive) a read-only file is created.
|
||||
// PbCommand.params(2) controls the file permissions. If "true" (case-insensitive) a read-only file is created.
|
||||
// The filename is relative to the default image folder and must not contain a slash.
|
||||
// The file size must be a multiple of 512.
|
||||
CREATE_IMAGE = 15;
|
||||
|
@ -216,6 +216,12 @@ void CommandCreateImage(const string&hostname, int port, const string& image_par
|
||||
command.add_params(image_params.substr(0, separatorPos));
|
||||
command.add_params(image_params.substr(separatorPos + 1));
|
||||
}
|
||||
else {
|
||||
cerr << "Error: Invalid file description '" << image_params << "', format is NAME:SIZE" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
command.add_params("false");
|
||||
|
||||
PbResult result;
|
||||
SendCommand(hostname.c_str(), port, command, result);
|
||||
@ -242,6 +248,10 @@ void CommandRenameImage(const string&hostname, int port, const string& image_par
|
||||
command.add_params(image_params.substr(0, separatorPos));
|
||||
command.add_params(image_params.substr(separatorPos + 1));
|
||||
}
|
||||
else {
|
||||
cerr << "Error: Invalid file description '" << image_params << "', format is OLD_NAME:NEW_NAME" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
PbResult result;
|
||||
SendCommand(hostname.c_str(), port, command, result);
|
||||
|
Loading…
Reference in New Issue
Block a user