Commits

Marcin Kasperski  committed f51e730

better diagnostics

  • Participants
  • Parent commits bd75d2c

Comments (0)

Files changed (1)

File src/mekk/fics/tell_commands/tell_errors.py

 class BadFreeParametersCount(InvalidCommandParameters):
     """Thrown when there are too many or not enough non-named params"""
     def __init__(self, given, min, max):
+        """ Good is min <= given < max
+        """
         self.min_count = min
         self.max_count = max
         self.given_count = given
         if max == 0:
             self.user_msg = "Got unexpected parameter"
-        elif min == max:
+        elif min+1 == max:
             self.user_msg = "Invalid parameters. Got %d params, expected %d" % (given, min)
         elif max is None:
             self.user_msg = "Invalid parameters. Got %d params, expected at least %d" % (given, min)
         else:
-            self.user_msg = "Invalid parameters. Got %d params, expected at from %d to %d" % (given, min, max)
+            self.user_msg = "Invalid parameters. Got %d params, expected at from %d to %d" % (given, min, max-1)