When a court does not apply the correct law or if it rests its decision on a clearly erroneous finding of a material fact. U.S. v. Rahm, 993 F.2d 1405, 1410 (9th Cir.'93). A court may also abuse its discretion when the record contains no evidence to support its decision. MGIC v. Moore, 952 F.2d 1120, 1122 (9th Cir.'91)
When judges make decisions on various questions, they must, of course, follow the standards set out by law. These standards, though, often allow judges a lot of leeway (which is called discretion). Judges are given this discretion so they can make decisions that are fair in a particular case, instead of being locked into a formula that may not suit every situation.
The exercise of judicial discretion is difficult to attack on appeal, because the decision, by law, was left to the judge in the first place. Nevertheless, judicial discretion must be exercised fairly and impartially, and a showing to the contrary may result in the ruling being reversed as an abuse of discretion.