-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: #7 error handling in stegano-core
- make the message struct creation fallible - apply the necessary fallible code all the layers up - add an old demo image format for tests
- Loading branch information
Showing
13 changed files
with
304 additions
and
227 deletions.
There are no files selected for viewing
Binary file added
BIN
+1.86 MB
resources/demo-secrets/message-version-1/text-only-without-passwd-v2.1.1.9.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use std::string::FromUtf8Error; | ||
use thiserror::Error; | ||
use zip::result::ZipError; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum SteganoError { | ||
/// Represents an unsupported carrier media. For example, a Movie file is not supported | ||
#[error("Media format is not supported")] | ||
UnsupportedMedia, | ||
|
||
/// Represents an invalid carrier audio media. For example, a broken WAV file | ||
#[error("Audio media is invalid")] | ||
InvalidAudioMedia, | ||
|
||
/// Represents an invalid carrier image media. For example, a broken PNG file | ||
#[error("Image media is invalid")] | ||
InvalidImageMedia, | ||
|
||
/// Represents an unsupported message format version, for example foreign formats or just data crap | ||
#[error("Unsupported message format version: {0}")] | ||
UnsupportedMessageFormat(u8), | ||
|
||
/// Represents the error of invalid UTF-8 text data found inside of a text only message | ||
#[error("Invalid text data found inside a message")] | ||
InvalidTextData(#[from] FromUtf8Error), | ||
|
||
/// Represents an unveil of no secret data. For example when a media did not contain any secrets | ||
#[error("No secret data found")] | ||
NoSecretData, | ||
|
||
/// Represents an error caused by an invalid filename, for example not unsupported charset or empty filename | ||
#[error("A file with an invalid file name was provided")] | ||
InvalidFileName, | ||
|
||
/// Represents an error when interacting with the document message payload | ||
#[error("Error during the payload processing for documents")] | ||
PayloadProcessingError(#[from] ZipError), | ||
|
||
/// Represents a failure to read from input. | ||
#[error("Read error")] | ||
ReadError { source: std::io::Error }, | ||
|
||
/// Represents a failure to write target file. | ||
#[error("Write error")] | ||
WriteError { source: std::io::Error }, | ||
|
||
/// Represents a failure when encoding an audio file. | ||
#[error("Audio encoding error")] | ||
AudioEncodingError, | ||
|
||
/// Represents a failure when encoding an image file. | ||
#[error("Image encoding error")] | ||
ImageEncodingError, | ||
|
||
/// Represents a failure when creating an audio file. | ||
#[error("Audio creation error")] | ||
AudioCreationError, | ||
|
||
/// Represents all other cases of `std::io::Error`. | ||
#[error(transparent)] | ||
IoError(#[from] std::io::Error), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.