Commit 6a3b111b7115f295b4e5b9644f90cd8d876cf52e
1 parent
cb2646a5
Slighly better error message
Showing
2 changed files
with
8 additions
and
3 deletions
CHANGELOG.md
include/CLI/Option.hpp
| ... | ... | @@ -155,12 +155,12 @@ public: |
| 155 | 155 | |
| 156 | 156 | /// Set the number of expected arguments (Flags bypass this) |
| 157 | 157 | Option* expected(int value) { |
| 158 | - if(!changeable_) | |
| 159 | - throw IncorrectConstruction("You can only change the expected arguments for vectors"); | |
| 160 | - else if(value == 0) | |
| 158 | + if(value == 0) | |
| 161 | 159 | throw IncorrectConstruction("Cannot set 0 expected, use a flag instead"); |
| 162 | 160 | else if(expected_ == 0) |
| 163 | 161 | throw IncorrectConstruction("Cannot make a flag take arguments!"); |
| 162 | + else if(!changeable_) | |
| 163 | + throw IncorrectConstruction("You can only change the expected arguments for vectors"); | |
| 164 | 164 | expected_ = value; |
| 165 | 165 | return this; |
| 166 | 166 | } | ... | ... |