I've been working on a contract in cairo starknet and i got this error :
Plugin diagnostic: The value does not fit within the range of type core::felt252. --> hello_starknet.cairo:54:46 assert(!isFriend(sender, recipient), 'this person is already your friend');
Any idea how to solve this?
I tried something i found on internet but not results :
assert(!isFriend(sender, recipient), TryInto::try_into('this person is already your friend').unwrap());
There is currently no way to handle string on cairo so the default type of any string inputed is felt252 and according to cairo book::
Obviously if you reduce the length of your string the error disappears. This is because the longer your string the higher or more likely it is for either an overflow to occur.
SOLUTION:: Use shorter string messages(this is the only solution that works for me so far) you can also make use of identifiers for different error messages and include them in your documentation.