diff --git a/python/dune/perftool/sumfact/switch.py b/python/dune/perftool/sumfact/switch.py
index 0aeef4f352e3fa8f8da50984ddc899ed677f4bb1..8a44d50923226b7971c46389d245760e587fde89 100644
--- a/python/dune/perftool/sumfact/switch.py
+++ b/python/dune/perftool/sumfact/switch.py
@@ -114,7 +114,7 @@ def generate_exterior_facet_switch():
                                                                               ),
                                                               args))
 
-    block.append("    default: throw(std::exception());")
+    block.append('    default: DUNE_THROW(Dune::Exception, "Variation not implemented.");')
     block.append("  }")
     block.append("}")
 
@@ -147,7 +147,7 @@ def generate_interior_facet_switch():
                                                                                           ),
                                                                           args))
 
-    block.append("    default: throw(std::exception());")
+    block.append('    default: DUNE_THROW(Dune::Exception, "Variation not implemented.");')
     block.append("  }")
     block.append("}")