Description:
Create an errors.rs file to define a centralized Error enum for all AssetsUp contracts, ensuring consistent error handling.
Tasks:
- Create
src/errors.rs with an Error enum including:
AssetAlreadyExists
AssetNotFound
BranchAlreadyExists
BranchNotFound
SubscriptionAlreadyExists
Unauthorized
InvalidPayment
- Use
#[contracttype] for the Error enum.
- Add documentation for each error case.
- Export the
Error enum for use in other modules.
- Update
lib.rs to include errors.rs as a module.
- Write a test to verify error handling in a dummy function.
Acceptance Criteria:
errors.rs defines a comprehensive Error enum with #[contracttype].
- Errors are documented and exported.
- Module compiles without errors.
- A test confirms that a dummy function returns an error correctly.
Description:
Create an
errors.rsfile to define a centralizedErrorenum for all AssetsUp contracts, ensuring consistent error handling.Tasks:
src/errors.rswith anErrorenum including:AssetAlreadyExistsAssetNotFoundBranchAlreadyExistsBranchNotFoundSubscriptionAlreadyExistsUnauthorizedInvalidPayment#[contracttype]for theErrorenum.Errorenum for use in other modules.lib.rsto includeerrors.rsas a module.Acceptance Criteria:
errors.rsdefines a comprehensiveErrorenum with#[contracttype].