Skip to content
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

Add error codes to topup #70

Merged
merged 4 commits into from
Oct 13, 2023
Merged

Conversation

dleutenegger
Copy link
Collaborator

No description provided.

@dleutenegger dleutenegger force-pushed the feature/provide-topup-error-codes branch 2 times, most recently from d19ac9f to 754ddee Compare October 13, 2023 13:28
crow/src/lib.rs Outdated
})
}

pub fn from_topup_error(error: Option<TopupError>) -> Option<String> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove it if we do not use it here.
The reason is that imagine we will change the string representations here, but the client is using it to store information in a db, they will not be able to read old records. It is the client responsibility to find a stable way to represent enum values as string.

crow/src/lib.rs Outdated
Comment on lines 255 to 257
_ => TopupError::TemporaryFailure {
code: TemporaryFailureCode::Unexpected,
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ => TopupError::TemporaryFailure {
code: TemporaryFailureCode::Unexpected,
},
e => TopupError::PermanentFailure {
code: PermanentFailureCode::Unexpected { msg: e.to_string() },
},

crow/src/lib.rs Outdated Show resolved Hide resolved
crow/src/lib.rs Outdated Show resolved Hide resolved
dleutenegger and others added 2 commits October 13, 2023 17:15
Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com>
@dleutenegger dleutenegger force-pushed the feature/provide-topup-error-codes branch from ef8f180 to 672c429 Compare October 13, 2023 15:25
@dleutenegger dleutenegger merged commit 0f4c10d into main Oct 13, 2023
6 checks passed
@dleutenegger dleutenegger deleted the feature/provide-topup-error-codes branch October 13, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants