Either not enough grip strength or like Will's situation. Usually your hands would toughen up as a result of holding onto walls, but stop holding onto sharp edges once it does more than just make your hands rough

.
Also, one thing we need to know is how you're holding onto the ledge of the wall. Are you only holding yourself by the tips of your fingers, using your fingers completely, using overgrip, or anything like that.