which approach is better for handling errors in my app
I am working on a chat app the user can add friends i am checking whether the recipent of the friend request is already in the user's friends list or not and i'm checking if the user attempts to send a friend request to himself i am currently handling these cases by return an object with success property of false and a message indicating the error , is that the right approach ? or should i throw an Error with the same messages i already have and handle it with try and catch statements .