Skip to content

Commit f9e6fd6

Browse files
committed
Give an error that makes sense for the user
Also, that coincides with docs
1 parent c6171c7 commit f9e6fd6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: src/Validate/SSN/Swedish.elm

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ validateAndNormalize : Maybe Date -> String -> Result String String
8282
validateAndNormalize date ssn =
8383
ssn
8484
|> Helpers.matchOne ssnRegex
85+
|> Result.mapError (\_ -> "Invalid Swedish SSN")
8586
|> Result.map .submatches
8687
|> Result.andThen (assembleNormalized date)
8788
|> Result.andThen luhnValidate

0 commit comments

Comments
 (0)