It is apparent that we should be angry with sin and come to hate that which would separate us from God or cause loss of fellowship.
This means there will be times when we will hate what others do because it goes contrary to the Word of God. Such anger may be referred to as "righteous indignation."
However, when self becomes projected into the matter, it is possible for a believer to sin, at least in his attitude toward others.
In Ephesians 4:26 Paul was warning against permitting smoldering fires of resentment to remain in anyone's heart: "Let not the sun go down upon your wrath."
We should make it our practice never to retire without first being sure that we have confessed known sin of actions and attitudes, "for the wrath of man worketh not the righteousness of God" (James 1:20).
Jesus was angry with those who withstood God. He called the Pharisees and Sadducees a "generation of vipers" (Matt. 3:7). The scribes and Pharisees He called "hypocrites" (23:14).
On another occasion He made a whip of small ropes and drove the money changers from the temple (John 2:13-16).
Although the Lord Jesus Christ was able to be angry without sinning, it is difficult for us. That is why Paul gave the command as he did in Ephesians 4:26.
Our anger should be stirred when God's name is taken in vain or when He is blasphemed, but we must be careful that we do not sin in the way we react to these incidents. If we speak unkind words or are embittered toward others, we have sinned and it needs to be confessed to the Lord.