The trial court exceeds its jurisdiction under Penal Code section 1054.5 when it excludes prosecution evidence without exhausting lesser sanctions. In a murder trial, the judge excluded dog-scent evidence, gun-shot residue evidence, and prosecution witnesses for the People’s failure to comply with discovery requests. The prosecutor filed a writ of mandate. Noting writ review is limited, the court held it would be available where the court’s act exceeds a grant of statutory authority. The court reviewed a trial court’s statutory power to enforce discovery orders under section 1054.5, and noted discretion was not unfettered. While subdivision (b) of the statute allows the trial court to exclude witness testimony, subdivision (c) limits the option to situations where “all other sanctions have been exhausted.” Here the court did not consider or exhaust other sanctions, so it acted in excess of statutory jurisdiction, and writ review was available. Writ relief was appropriate because it would not unreasonably harass the defendant. On remand, the trial court can explore other sanctions.