Skip to content

Commit

Permalink
Improve fellowship error (#298)
Browse files Browse the repository at this point in the history
* change error

* fmt
  • Loading branch information
f-gate authored Dec 20, 2023
1 parent 2717c22 commit a05018f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pallets/briefs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ pub mod pallet {
EoaRequiredForForeignCurrencies,
/// Currency is not supported for this external address.
CurrencyAccountComboNotSupported,
/// You must be a fellow to start this work.
FellowshipRequired,
}

#[pallet::call]
Expand All @@ -186,7 +188,8 @@ pub mod pallet {
let who = ensure_signed(origin)?;

if require_fellowship {
T::EnsureRole::ensure_role(&applicant, pallet_fellowship::Role::Freelancer, None)?;
T::EnsureRole::ensure_role(&applicant, pallet_fellowship::Role::Freelancer, None)
.map_err(|_| Error::<T>::FellowshipRequired)?;
}

ensure!(
Expand Down
2 changes: 1 addition & 1 deletion pallets/briefs/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn create_brief_not_approved_applicant() {
None,
true,
),
BadOrigin
Error::<Test>::FellowshipRequired
);
});
}
Expand Down

0 comments on commit a05018f

Please sign in to comment.