-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-13371] Repository split - Avoid depdending on Bitwarden #1124
Changes from all commits
7ae040c
c2a4c85
ae414ea
2a76c27
1285a45
9dc0e90
f4393d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
use std::fmt::{Display, Formatter}; | ||
|
||
use bitwarden_exporters::ExportError; | ||
use bitwarden_generators::{PassphraseError, PasswordError, UsernameError}; | ||
|
||
// Name is converted from *Error to *Exception, so we can't just name the enum Error because | ||
// Exception already exists | ||
#[derive(uniffi::Error, Debug)] | ||
#[uniffi(flat_error)] | ||
pub enum BitwardenError { | ||
E(bitwarden::error::Error), | ||
E(Error), | ||
} | ||
|
||
impl From<bitwarden::Error> for BitwardenError { | ||
fn from(e: bitwarden::Error) -> Self { | ||
impl From<bitwarden_core::Error> for BitwardenError { | ||
fn from(e: bitwarden_core::Error) -> Self { | ||
Self::E(e.into()) | ||
} | ||
} | ||
|
||
impl From<bitwarden::error::Error> for BitwardenError { | ||
fn from(e: bitwarden::error::Error) -> Self { | ||
impl From<Error> for BitwardenError { | ||
fn from(e: Error) -> Self { | ||
Self::E(e) | ||
} | ||
} | ||
|
@@ -37,3 +40,42 @@ | |
} | ||
|
||
pub type Result<T, E = BitwardenError> = std::result::Result<T, E>; | ||
|
||
#[derive(thiserror::Error, Debug)] | ||
pub enum Error { | ||
#[error(transparent)] | ||
Core(#[from] bitwarden_core::Error), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will probably be a breaking change for the mobile apps, we will need to notify them before we make a new release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, I reverted it we should find some time to resolve the external error issue in uniffi. |
||
|
||
// Generators | ||
#[error(transparent)] | ||
UsernameError(#[from] UsernameError), | ||
#[error(transparent)] | ||
PassphraseError(#[from] PassphraseError), | ||
#[error(transparent)] | ||
PasswordError(#[from] PasswordError), | ||
|
||
// Vault | ||
#[error(transparent)] | ||
Cipher(#[from] bitwarden_vault::CipherError), | ||
#[error(transparent)] | ||
Totp(#[from] bitwarden_vault::TotpError), | ||
|
||
#[error(transparent)] | ||
ExportError(#[from] ExportError), | ||
|
||
// Fido | ||
#[error(transparent)] | ||
MakeCredential(#[from] bitwarden_fido::MakeCredentialError), | ||
#[error(transparent)] | ||
GetAssertion(#[from] bitwarden_fido::GetAssertionError), | ||
#[error(transparent)] | ||
SilentlyDiscoverCredentials(#[from] bitwarden_fido::SilentlyDiscoverCredentialsError), | ||
#[error(transparent)] | ||
CredentialsForAutofillError(#[from] bitwarden_fido::CredentialsForAutofillError), | ||
#[error(transparent)] | ||
DecryptFido2AutofillCredentialsError( | ||
#[from] bitwarden_fido::DecryptFido2AutofillCredentialsError, | ||
), | ||
#[error(transparent)] | ||
Fido2Client(#[from] bitwarden_fido::Fido2ClientError), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
bitwarden-json
is going to be a secrets manager only crate now, we can probably remove the secrets feature as well right?