From 818e1c8d1c8de3ce2e09e2682422267ca92fa5c0 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 5 Jan 2019 19:50:56 +0000 Subject: [PATCH] Return specific error codes from command execution. --- DiscImageChef.CommonTypes.csproj | 1 + Enums/ErrorNumber.cs | 115 +++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 Enums/ErrorNumber.cs diff --git a/DiscImageChef.CommonTypes.csproj b/DiscImageChef.CommonTypes.csproj index f31665625..089cf06cc 100644 --- a/DiscImageChef.CommonTypes.csproj +++ b/DiscImageChef.CommonTypes.csproj @@ -50,6 +50,7 @@ Metadata/cicm.cs + diff --git a/Enums/ErrorNumber.cs b/Enums/ErrorNumber.cs new file mode 100644 index 000000000..29d8d0016 --- /dev/null +++ b/Enums/ErrorNumber.cs @@ -0,0 +1,115 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : ErrorNumber.cs +// Author(s) : Natalia Portillo +// +// Component : Common types. +// +// --[ Description ] ---------------------------------------------------------- +// +// Defines enumerations of error numbers. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2019 Natalia Portillo +// ****************************************************************************/ + +namespace DiscImageChef.CommonTypes.Enums +{ + /// + /// Enumerates error codes. Positive for warnings or informative codes, negative for errors. + /// + public enum ErrorNumber + { + /// No error + NoError = 0, + /// User requested help to be shown + HelpRequested = 1, + /// Command found nothing + NothingFound = 2, + /// Media has been already dumped completely + AlreadyDumped = 3, + /// Image and its sectors cannot be verified + NotVerificable = 4, + /// There are bad sectors and image cannot be verified + BadSectorsImageNotVerified = 5, + /// All sectors are good and image cannot be verified + CorrectSectorsImageNotVerified = 6, + /// Image is bad and sectors cannot be verified + BadImageSectorsNotVerified = 7, + /// Image is bad and there are bad sectors + BadImageBadSectors = 8, + /// All sectors are good and image is bad + CorrectSectorsBadImage = 9, + /// Image is good and sectors cannot be verified + CorrectImageSectorsNotVerified = 10, + /// Image is good and there are bad sectors + CorrectImageBadSectors = 11, + /// Exception has been raised + UnexpectedException = -1, + /// The number of arguments is not as expected + UnexpectedArgumentCount = -2, + /// A required argument is not present + MissingArgument = -3, + /// A specified argument contains an invalid value + InvalidArgument = -4, + /// The specified file cannot be found + FileNotFound = -5, + /// The specified file cannot be opened + CannotOpenFile = -6, + /// The specified encoding cannot be found + EncodingUnknown = -7, + /// The image format has not been recognized + UnrecognizedFormat = -8, + /// The image format failed to open + CannotOpenFormat = -9, + /// The specified metadata sidecar does not have the correct format + InvalidSidecar = -10, + /// The specified resume map does not have the correct format + InvalidResume = -11, + /// The specified destination file/folder already exists + DestinationExists = -12, + /// The specified image format cannot be found + FormatNotFound = -13, + /// More than one format found for the specified search criteria + TooManyFormats = -14, + /// The specified format does not support the specified media + UnsupportedMedia = -15, + /// Data will be lost writing the specified format + DataWillBeLost = -16, + /// Cannot create destination format + CannotCreateFormat = -17, + /// Error writing data + WriteError = -18, + /// Argument expected a directory, but found a file + ExpectedDirectory = -19, + /// Argument expected a file, but found a directory + ExpectedFile = -20, + /// Cannot open device + CannotOpenDevice = -21, + /// The specified operation requires administrative privileges + NotEnoughPermissions = -22 + } +} \ No newline at end of file