"But above all, my brethren, do not swear, either by heaven or by earth or with any other oath. But let your Yes be Yes, and your No, No, lest you fall into judgment."
Everyone of the Apostles swore an oath to stand by the Lord even unto death; Peter being the most prominent....and EACH ONE broke that oath,and fled the Lord Jesus a short time later in the face of the lynch Mob at Gethsemane.
Judgment, in James 5, could also be translated "CONDEMNATION". This is from the devil not God, for there is no condemnation for those in Christ Jesus.
Roman's 8: "There is therefore now no condemnation to those who are in Christ Jesus, who do not walk according to the flesh, but according to the Spirit... For the law of the Spirit of life in Christ Jesus has made me free from the law of sin and death."
Each one of us, at some time or another, have been foolish enough to make an oath, that we could not keep. The Apostles sure did. Jesus spoke to Paul, and said, "My strength is perfected through WEAKNESS."
2 Corinthians 12:9
And He said to me, My grace is sufficient for you, for My strength is made perfect in weakness. Therefore most gladly I will rather boast in my infirmities, that the power of Christ may rest upon me."
He knows of our feeble attempts to please Him by virtue of our more than not pitiful attempts to do so through works, and often prideful declarations that may accompany them. They are vanity, and He mercifully cleanses us of them, when we confess and forsake our own strength to depend upon His.
If this were not so, we would all be struck dead by now, or at best, just have fallen away into hopeless despair confronting our failures.