git.delta.rocks / unique-network / refs/commits / 6ac8e66dbab7

difftreelog

Add proper common pallet errors

Daniel Shiposha2022-05-11parent: #faf0594.patch.diff
in: master

1 file changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
366 /// Tried to store more data than allowed in collection field366 /// Tried to store more data than allowed in collection field
367 CollectionFieldSizeExceeded,367 CollectionFieldSizeExceeded,
368368
369 /// Tried to store more property data than allowed
369 NoSpaceForProperty,370 NoSpaceForProperty,
370371
372 /// Tried to store more property keys than allowed
371 PropertyLimitReached,373 PropertyLimitReached,
374
375 /// Unable to read array of unbounded keys
376 UnableToReadUnboundedKeys,
372 }377 }
373378
374 #[pallet::storage]379 #[pallet::storage]
865 ) -> Result<Vec<PropertyKey>, DispatchError> {870 ) -> Result<Vec<PropertyKey>, DispatchError> {
866 keys.into_iter()871 keys.into_iter()
867 .map(|key| -> Result<PropertyKey, DispatchError> {872 .map(|key| -> Result<PropertyKey, DispatchError> {
868 // TODO Fix error
869 key.try_into()873 key.try_into()
870 .map_err(|_| DispatchError::Other("Can't read property key"))874 .map_err(|_| <Error<T>>::UnableToReadUnboundedKeys.into())
871 })875 })
872 .collect::<Result<Vec<PropertyKey>, DispatchError>>()876 .collect::<Result<Vec<PropertyKey>, DispatchError>>()
873 }877 }