diff options
author | Lee Jarvis <lee@jrvs.uk> | 2023-02-15 11:28:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 11:28:21 -0800 |
commit | 2410f313984be1dfe73884251e879b008771535d (patch) | |
tree | 8f36d5b4c65685653e0c8ef3c344d5fe75564fd6 /lib/slop/error.rb | |
parent | fc4622fc08d7982847ff583ad691ee4ba47f63f8 (diff) | |
parent | becc0305239c2885affb1f57419afac3e5418a88 (diff) | |
download | slop-2410f313984be1dfe73884251e879b008771535d.tar.gz |
Merge pull request #278 from heyvito/feat/validate-types
Add support to optional type validation
Diffstat (limited to 'lib/slop/error.rb')
-rw-r--r-- | lib/slop/error.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/slop/error.rb b/lib/slop/error.rb index ddfa1a7..b83cab3 100644 --- a/lib/slop/error.rb +++ b/lib/slop/error.rb @@ -38,4 +38,16 @@ module Slop # Suppress with the `suppress_errors` config option. class MissingRequiredOption < Error end + + # Raised when a given option is provided by the user and does not + # match the expected format for that type. This is only raised if + # validate_types is set to true. + class InvalidOptionValue < Error + attr_reader :flag + + def initialize(msg, flag) + super(msg) + @flag = flag + end + end end |