diff --git a/src/colvar/Coordination.cpp b/src/colvar/Coordination.cpp
index fd1aa8b0e5620b4de783c01490b18c71e0e28c64..7f3d0d0f62a116c9c0d5daa159f202c70de484f4 100644
--- a/src/colvar/Coordination.cpp
+++ b/src/colvar/Coordination.cpp
@@ -84,8 +84,10 @@ CoordinationBase(ao)
 
   string sw,errors;
   parse("SWITCH",sw);
-  if(sw.length()>0) switchingFunction.set(sw,errors);
-  else {
+  if(sw.length()>0){
+    switchingFunction.set(sw,errors);
+    if( errors.length()!=0 ) error("problem reading SWITCH keyword : " + errors );
+  } else {
     int nn=6;
     int mm=12;
     double d0=0.0;