Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise ArgumentError if Version is initialized with a nil version string #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timrogers
Copy link

At the moment, Semantic::Version.new raises a NoMethodError exception like this if you try to pass in nil as the version string:

undefined method `match' for nil:NilClass (NoMethodError)

v = version_str.match(SemVerRegexp)

This alters the behaviour to raise an ArgumentError instead, which is what we do if you pass a malformed string (e.g. dasd). This is a breaking change to the library's API - but it feels like a more reasonable and unsurprising behaviour.

…n string

At the moment, `Semantic::Version.new` raises a `NoMethodError`
exception like this if you try to pass in `nil` as the version
string:

```
undefined method `match' for nil:NilClass (NoMethodError)

v = version_str.match(SemVerRegexp)
```

This alters the behaviour to raise an `ArgumentError` instead,
which is what we do if you pass a malformed string (e.g.
`dasd`). This is a breaking change - but feels like a more
reasonable and unsurprising behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant