pickError picks a DispatchError (thrown in one of many possible pallets) or undefined from DecodedContractResult returned by useCall, and similar hooks.
constget=useCall<number>(flipper,'get')pickError(get) // returns a Dispatch Error or `undefined`
pickDecodedError picks a DispatchError (thrown in one of many possible pallets) or undefined from DecodedContractResult and returns a string error message. This is a wrapper around decodeError.
constget=useCall<number>(flipper,'get')consterrMessage=pickDecodedError(get,flipper,{ContractTrapped:'This is a custom message. There was a panic in the contract!'},'Something went wrong... This is a default error message',);console.error(errMessage);// string or undefined