Skip to content

💡 [REQUEST] - Generate errors enum in types.rs #440

@SteMak

Description

@SteMak

Summary

The errors enum is missed from being generated in types.rs file

#[error_code]
pub enum SCError {
    #[msg("Unauthorized signer")]
    Unauthorized,
    #[msg("Limit exceeded")]
    Exceeded,
}

This limits experience of program fails with custom errors validation

Basic Example

Ability to compare get_custom_error_code() with enum instead of hardcoded codes

if res.is_success() {

} else if res.get_custom_error_code() == Some(SCError::Unauthorized) {

} else if res.get_custom_error_code() == Some(SCError::Exceeded) {

} else {

}

Drawbacks

No response

Unresolved questions

No response

Implementation PR

No response

Reference Issues

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions