There can be times when we feel that the wheel of fortune has turned out of our favor. In Yiddishkeit, however, one has to know that nothing is by chance, and this misfortune occurred for a reason. The first thing one should do in such a situation is to review one's past behavior, as illustrated by the following story brought in the Gemara:
The following is a short synopsis of the story:
Four hundred barrels of Rav Huna’s wine fermented and turned into vinegar, causing him significant financial loss. Following the advice of his colleagues, R’ Huna reviewed his past behavior and found a minor misdeed that entailed a minor moral mistake in collecting money owed to him. After resolving the issue, the four hundred barrels of vinegar miraculously turned back into wine.
Brachos 5b