diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b60030..f60ecb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ The `Unreleased` section name is replaced by the expected version of next releas ### Removed ### Fixed +- Clarify `StreamName.parse` exception message [#58](https://github.com/jet/FsCodec/pull/58) :pray: [@dharmaturtle](https://github.com/dharmaturtle) + ## [2.1.1] - 2020-05-25 diff --git a/src/FsCodec/StreamName.fs b/src/FsCodec/StreamName.fs index 5cf3bcc..b84147b 100755 --- a/src/FsCodec/StreamName.fs +++ b/src/FsCodec/StreamName.fs @@ -44,7 +44,7 @@ module StreamName = /// Throws InvalidArgumentException if it does not adhere to that form let parse (rawStreamName : string) : StreamName = if rawStreamName.IndexOf('-') = -1 then - invalidArg (sprintf "Stream Name '%s' must contain a '-' separator" rawStreamName) "streamName" + invalidArg "streamName" (sprintf "Stream Name '%s' must contain a '-' separator" rawStreamName) UMX.tag rawStreamName (* Parsing: Raw Stream name Validation functions/pattern that handle malformed cases without throwing *) diff --git a/tests/FsCodec.NewtonsoftJson.Tests/FsCodec.NewtonsoftJson.Tests.fsproj b/tests/FsCodec.NewtonsoftJson.Tests/FsCodec.NewtonsoftJson.Tests.fsproj index 2b47579..e032670 100644 --- a/tests/FsCodec.NewtonsoftJson.Tests/FsCodec.NewtonsoftJson.Tests.fsproj +++ b/tests/FsCodec.NewtonsoftJson.Tests/FsCodec.NewtonsoftJson.Tests.fsproj @@ -15,13 +15,13 @@ - - + + - + diff --git a/tests/FsCodec.SystemTextJson.Tests/FsCodec.SystemTextJson.Tests.fsproj b/tests/FsCodec.SystemTextJson.Tests/FsCodec.SystemTextJson.Tests.fsproj index 25fabfd..d4d5480 100644 --- a/tests/FsCodec.SystemTextJson.Tests/FsCodec.SystemTextJson.Tests.fsproj +++ b/tests/FsCodec.SystemTextJson.Tests/FsCodec.SystemTextJson.Tests.fsproj @@ -7,13 +7,13 @@ - + - + - + diff --git a/tests/FsCodec.Tests/FsCodec.Tests.fsproj b/tests/FsCodec.Tests/FsCodec.Tests.fsproj index 9725e04..cef43dd 100644 --- a/tests/FsCodec.Tests/FsCodec.Tests.fsproj +++ b/tests/FsCodec.Tests/FsCodec.Tests.fsproj @@ -11,10 +11,10 @@ - + - + diff --git a/tests/FsCodec.Tests/StreamNameTests.fs b/tests/FsCodec.Tests/StreamNameTests.fs index 373481f..6eaaac7 100644 --- a/tests/FsCodec.Tests/StreamNameTests.fs +++ b/tests/FsCodec.Tests/StreamNameTests.fs @@ -30,7 +30,8 @@ let [] ``Can roundtrip single aggregateIds with embedded dashes and unders test <@ let (StreamName.CategoryAndIds (scat, aggIds)) = sn scat = cat && ["a-b";"c-d"] = List.ofArray aggIds @> -let [] ``StreamName.parse throws given 0 separators`` () = - raisesWith - <@ StreamName.parse "Cat" @> - (fun e -> <@ e.Message = "streamName (Parameter 'Stream Name 'Cat' must contain a '-' separator')" @>) +let [] ``StreamName parse throws given 0 separators`` () = + raisesWith <@ StreamName.parse "Cat" @> + (fun (e : System.ArgumentException) -> <@ + e.ParamName = "streamName" + && e.Message.StartsWith "Stream Name 'Cat' must contain a '-' separator" @>)