Job erred, it is true. But his error was not in the fact that he had trouble accepting the future as he saw it. Jesus teaches us in the Garden of Gethsemane that it is part of the human psyche to shrink from what appears painful and debilitating. And some trials do not go way at all. The loss of Job's children was something Job would live with for the rest of his life.
Providence is always purposive.
It is always intelligent rather than whimsical. But it is not beyond God's. However mysterious things may be to us, they are not so to God. Even if God chose to disclose that purpose, it is doubtful that we could ever understand it. The purposes of God in suffering are designed specifically for each individual.