Losing hope when a slippage occurs is a sign of relying too much on (one's own) deeds.
An ordinary servant of Allah depends on his deeds including his prayers and supplications to enter the Paradise and escape from Allah's punishment whereas a spiritual aspirant (murid) takes his deeds a means to reach Allah. But an enlightened servant (gnostic or 'arif ) will never trust or depend on his deeds. He will neither rejoice over a good thing he did, nor regret a fault that happened to him, because he has dedicated himself to Allah so that his doing or undoing is no more important for him.
Since people belonging to the first and second category ascribe their success or failure to their deeds, they lose hope when they commit a mistake; but those who belong to the third category is so preoccupied with Allah that they are not concerned about the value of their deeds.
Since he does not want his selfish motives to dilute the quality of his worship, the enlightened servant makes Allah the pivot of whatever he does. If achieving any selfish interest, even if it be entering the paradise, becomes the objective of worship, Allah will cease to become the first priority. With the focus shifting from Allah to something lesser such as self, worship loses much of its sheen and becomes a substandard means to scrape through the test of Allah.
If a man rejoices over a good thing he did, it means he is furtively impressed by his calibre and skills which he believes enabled him to do that; but his pleasure is totally misplaced because he is unable to do that without Allah's blessings. If he loses hope when he commits a mistake, it also shows that he attaches too much importance to his deeds. When he himself becomes the focus of his deeds, His worship hardly serves the purpose demanded of it. One who considers each supplication a means to improve the prospect of winning an individual achievement and each mistake as an opportunity squandered, will mourn his mistakes as if he were responsible for it and were to pay the penalty for it.