remove old style catches from the library
This removes the old style catches and replaces them with try/catch. It seems to make the code much clearer and its certainly less failure prone.
This commit is contained in:
parent
8dda138814
commit
eecbb26a2d
2 changed files with 6 additions and 5 deletions
|
@ -88,10 +88,10 @@ compare_toks2(_ToksA, _ToksB) ->
|
|||
|
||||
-spec to_int(string()) -> integer().
|
||||
to_int(String) ->
|
||||
case catch list_to_integer(String) of
|
||||
Integer when is_integer(Integer) ->
|
||||
Integer;
|
||||
_ ->
|
||||
try
|
||||
list_to_integer(String)
|
||||
catch
|
||||
error:badarg ->
|
||||
throw(invalid_semver_string)
|
||||
end.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue