mirror of
https://github.com/timvisee/ffsend.git
synced 2025-10-03 17:49:15 +02:00
Lowercase API error messages
This commit is contained in:
parent
4ddfbeb4b6
commit
bb508ac743
1 changed files with 27 additions and 27 deletions
|
@ -343,25 +343,25 @@ pub enum Error {
|
||||||
/// A general error occurred while requesting the file data.
|
/// A general error occurred while requesting the file data.
|
||||||
/// This may be because authentication failed, because decrypting the
|
/// This may be because authentication failed, because decrypting the
|
||||||
/// file metadata didn't succeed, or due to some other reason.
|
/// file metadata didn't succeed, or due to some other reason.
|
||||||
#[fail(display = "Failed to request file data")]
|
#[fail(display = "failed to request file data")]
|
||||||
Request(#[cause] RequestError),
|
Request(#[cause] RequestError),
|
||||||
|
|
||||||
/// The given Send file has expired, or did never exist in the first place.
|
/// The given Send file has expired, or did never exist in the first place.
|
||||||
/// Therefore the file could not be downloaded.
|
/// Therefore the file could not be downloaded.
|
||||||
#[fail(display = "The file has expired or did never exist")]
|
#[fail(display = "the file has expired or did never exist")]
|
||||||
Expired,
|
Expired,
|
||||||
|
|
||||||
/// An error occurred while downloading the file.
|
/// An error occurred while downloading the file.
|
||||||
#[fail(display = "Failed to download the file")]
|
#[fail(display = "failed to download the file")]
|
||||||
Download(#[cause] DownloadError),
|
Download(#[cause] DownloadError),
|
||||||
|
|
||||||
/// An error occurred while decrypting the downloaded file.
|
/// An error occurred while decrypting the downloaded file.
|
||||||
#[fail(display = "Failed to decrypt the downloaded file")]
|
#[fail(display = "failed to decrypt the downloaded file")]
|
||||||
Decrypt,
|
Decrypt,
|
||||||
|
|
||||||
/// An error occurred while opening or writing to the target file.
|
/// An error occurred while opening or writing to the target file.
|
||||||
// TODO: show what file this is about
|
// TODO: show what file this is about
|
||||||
#[fail(display = "Could not open the file for writing")]
|
#[fail(display = "could not open the file for writing")]
|
||||||
File(#[cause] FileError),
|
File(#[cause] FileError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,11 +374,11 @@ impl From<AuthError> for Error {
|
||||||
#[derive(Fail, Debug)]
|
#[derive(Fail, Debug)]
|
||||||
pub enum RequestError {
|
pub enum RequestError {
|
||||||
/// Failed authenticating, in order to fetch the file data.
|
/// Failed authenticating, in order to fetch the file data.
|
||||||
#[fail(display = "Failed to authenticate")]
|
#[fail(display = "failed to authenticate")]
|
||||||
Auth(#[cause] AuthError),
|
Auth(#[cause] AuthError),
|
||||||
|
|
||||||
/// Failed to retrieve the file metadata.
|
/// Failed to retrieve the file metadata.
|
||||||
#[fail(display = "Failed to retrieve file metadata")]
|
#[fail(display = "failed to retrieve file metadata")]
|
||||||
Meta(#[cause] MetaError),
|
Meta(#[cause] MetaError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,24 +386,24 @@ pub enum RequestError {
|
||||||
pub enum AuthError {
|
pub enum AuthError {
|
||||||
/// Sending the request to gather the authentication encryption nonce
|
/// Sending the request to gather the authentication encryption nonce
|
||||||
/// failed.
|
/// failed.
|
||||||
#[fail(display = "Failed to request authentication nonce")]
|
#[fail(display = "failed to request authentication nonce")]
|
||||||
NonceReq,
|
NonceReq,
|
||||||
|
|
||||||
/// The response for fetching the authentication encryption nonce
|
/// The response for fetching the authentication encryption nonce
|
||||||
/// indicated an error and wasn't successful.
|
/// indicated an error and wasn't successful.
|
||||||
#[fail(display = "Bad HTTP response '{}' while requesting authentication nonce", _1)]
|
#[fail(display = "bad HTTP response '{}' while requesting authentication nonce", _1)]
|
||||||
NonceReqStatus(StatusCode, String),
|
NonceReqStatus(StatusCode, String),
|
||||||
|
|
||||||
/// No authentication encryption nonce was included in the response
|
/// No authentication encryption nonce was included in the response
|
||||||
/// from the server, it was missing.
|
/// from the server, it was missing.
|
||||||
#[fail(display = "Missing authentication nonce in server response")]
|
#[fail(display = "missing authentication nonce in server response")]
|
||||||
NoNonceHeader,
|
NoNonceHeader,
|
||||||
|
|
||||||
/// The authentication encryption nonce from the response malformed or
|
/// The authentication encryption nonce from the response malformed or
|
||||||
/// empty.
|
/// empty.
|
||||||
/// Maybe the server responded with a new format that isn't supported yet
|
/// Maybe the server responded with a new format that isn't supported yet
|
||||||
/// by this client.
|
/// by this client.
|
||||||
#[fail(display = "Received malformed authentication nonce")]
|
#[fail(display = "received malformed authentication nonce")]
|
||||||
MalformedNonce,
|
MalformedNonce,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,36 +411,36 @@ pub enum AuthError {
|
||||||
pub enum MetaError {
|
pub enum MetaError {
|
||||||
/// An error occurred while computing the cryptographic signature used for
|
/// An error occurred while computing the cryptographic signature used for
|
||||||
/// decryption.
|
/// decryption.
|
||||||
#[fail(display = "Failed to compute cryptographic signature")]
|
#[fail(display = "failed to compute cryptographic signature")]
|
||||||
ComputeSignature,
|
ComputeSignature,
|
||||||
|
|
||||||
/// Sending the request to gather the metadata encryption nonce failed.
|
/// Sending the request to gather the metadata encryption nonce failed.
|
||||||
#[fail(display = "Failed to request metadata nonce")]
|
#[fail(display = "failed to request metadata nonce")]
|
||||||
NonceReq,
|
NonceReq,
|
||||||
|
|
||||||
/// The response for fetching the metadata encryption nonce indicated an
|
/// The response for fetching the metadata encryption nonce indicated an
|
||||||
/// error and wasn't successful.
|
/// error and wasn't successful.
|
||||||
#[fail(display = "Bad HTTP response '{}' while requesting metadata nonce", _1)]
|
#[fail(display = "bad HTTP response '{}' while requesting metadata nonce", _1)]
|
||||||
NonceReqStatus(StatusCode, String),
|
NonceReqStatus(StatusCode, String),
|
||||||
|
|
||||||
/// No metadata encryption nonce was included in the response from the
|
/// No metadata encryption nonce was included in the response from the
|
||||||
/// server, it was missing.
|
/// server, it was missing.
|
||||||
#[fail(display = "Missing metadata nonce in server response")]
|
#[fail(display = "missing metadata nonce in server response")]
|
||||||
NoNonceHeader,
|
NoNonceHeader,
|
||||||
|
|
||||||
/// The metadata encryption nonce from the response malformed or empty.
|
/// The metadata encryption nonce from the response malformed or empty.
|
||||||
/// Maybe the server responded with a new format that isn't supported yet
|
/// Maybe the server responded with a new format that isn't supported yet
|
||||||
/// by this client.
|
/// by this client.
|
||||||
#[fail(display = "Received malformed metadata nonce")]
|
#[fail(display = "received malformed metadata nonce")]
|
||||||
MalformedNonce,
|
MalformedNonce,
|
||||||
|
|
||||||
/// The received metadata is malformed, and couldn't be decoded or
|
/// The received metadata is malformed, and couldn't be decoded or
|
||||||
/// interpreted.
|
/// interpreted.
|
||||||
#[fail(display = "Received malformed metadata")]
|
#[fail(display = "received malformed metadata")]
|
||||||
Malformed,
|
Malformed,
|
||||||
|
|
||||||
/// Failed to decrypt the received metadata.
|
/// Failed to decrypt the received metadata.
|
||||||
#[fail(display = "Failed to decrypt received metadata")]
|
#[fail(display = "failed to decrypt received metadata")]
|
||||||
Decrypt,
|
Decrypt,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,47 +448,47 @@ pub enum MetaError {
|
||||||
pub enum DownloadError {
|
pub enum DownloadError {
|
||||||
/// An error occurred while computing the cryptographic signature used for
|
/// An error occurred while computing the cryptographic signature used for
|
||||||
/// downloading the file.
|
/// downloading the file.
|
||||||
#[fail(display = "Failed to compute cryptographic signature")]
|
#[fail(display = "failed to compute cryptographic signature")]
|
||||||
ComputeSignature,
|
ComputeSignature,
|
||||||
|
|
||||||
/// Sending the request to gather the metadata encryption nonce failed.
|
/// Sending the request to gather the metadata encryption nonce failed.
|
||||||
#[fail(display = "Failed to request file download")]
|
#[fail(display = "failed to request file download")]
|
||||||
Request,
|
Request,
|
||||||
|
|
||||||
/// The response for downloading the indicated an error and wasn't successful.
|
/// The response for downloading the indicated an error and wasn't successful.
|
||||||
#[fail(display = "Bad HTTP response '{}' while requesting file download", _1)]
|
#[fail(display = "bad HTTP response '{}' while requesting file download", _1)]
|
||||||
RequestStatus(StatusCode, String),
|
RequestStatus(StatusCode, String),
|
||||||
|
|
||||||
/// The length of the file is missing, thus the length of the file to download
|
/// The length of the file is missing, thus the length of the file to download
|
||||||
/// couldn't be determined.
|
/// couldn't be determined.
|
||||||
#[fail(display = "Couldn't determine file download length, missing property")]
|
#[fail(display = "couldn't determine file download length, missing property")]
|
||||||
NoLength,
|
NoLength,
|
||||||
|
|
||||||
/// Failed to start or update the downloading progress, because of this the
|
/// Failed to start or update the downloading progress, because of this the
|
||||||
/// download can't continue.
|
/// download can't continue.
|
||||||
#[fail(display = "Failed to update download progress")]
|
#[fail(display = "failed to update download progress")]
|
||||||
Progress,
|
Progress,
|
||||||
|
|
||||||
/// The actual download and decryption process the server.
|
/// The actual download and decryption process the server.
|
||||||
/// This covers reading the file from the server, decrypting the file,
|
/// This covers reading the file from the server, decrypting the file,
|
||||||
/// and writing it to the file system.
|
/// and writing it to the file system.
|
||||||
#[fail(display = "Failed to download the file")]
|
#[fail(display = "failed to download the file")]
|
||||||
Download,
|
Download,
|
||||||
|
|
||||||
/// Verifiying the downloaded file failed.
|
/// Verifiying the downloaded file failed.
|
||||||
#[fail(display = "File verification failed")]
|
#[fail(display = "file verification failed")]
|
||||||
Verify,
|
Verify,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Fail, Debug)]
|
#[derive(Fail, Debug)]
|
||||||
pub enum FileError {
|
pub enum FileError {
|
||||||
/// An error occurred while creating or opening the file to write to.
|
/// An error occurred while creating or opening the file to write to.
|
||||||
#[fail(display = "Failed to create or open file")]
|
#[fail(display = "failed to create or open file")]
|
||||||
Create(#[cause] IoError),
|
Create(#[cause] IoError),
|
||||||
|
|
||||||
/// Failed to create an encrypted writer for the file, which is used to
|
/// Failed to create an encrypted writer for the file, which is used to
|
||||||
/// decrypt the downloaded file.
|
/// decrypt the downloaded file.
|
||||||
#[fail(display = "Failed to create file decryptor")]
|
#[fail(display = "failed to create file decryptor")]
|
||||||
EncryptedWriter,
|
EncryptedWriter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue