Skip to content

Conversation

@cloudRoutine
Copy link
Contributor

@cloudRoutine cloudRoutine commented Aug 17, 2016

Implements more detailed error messages using formatted strings that contain the current error message and specifics about why the exception was thrown.

Described in detail - #1438

kevinr -- Link with whitespace changes ignored: https://github.com/Microsoft/visualfsharp/pull/1454/files?w=1

@cloudRoutine
Copy link
Contributor Author

cloudRoutine commented Aug 19, 2016

I think this is at the point where it could use some review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good idea to replace all the assertions with duplicated logic and have better error message.

Should it be checkConsistency or even assertConsistency (I assume it raises an exception if the equality is not observed).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default it does not, if run with Check.QuickThrowOnFailure that method will throw the exception when the Property returns a failing case.

@smoothdeveloper
Copy link
Contributor

I like those changes to get more user-friendly and useful error message in the core library and I like the pass of slight refactoring to reduce duplication / better encapsulation of the logic building those messages.

👍

@cloudRoutine
Copy link
Contributor Author

@dotnet-bot test this please

@cloudRoutine
Copy link
Contributor Author

@KevinRansom I tried to set this up to make it easier for localization, but I'm not sure how to take this forward.

The only places where any descriptive text is used apart from the names of the function's arguments are in the DetailedExceptions module and the axis & bound names for Array2D

Is there anything else I need to do to get this PR merge-ready?


/// helper function that creates labeled FsCheck properties for equality comparisons
let consistency name sqs ls arr =
(sqs = arr) |@ (sprintf "Seq.%s = %A, Array.%s = %A" name sqs name arr) .&.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put ticks around the %A I.e. '%A' it allows us to see that a value is missing in the event of bugs.

@KevinRansom
Copy link
Contributor

@cloudRoutine localization is not needed for fieldnames, or argument names.


namespace Microsoft.FSharp.Core

module internal DetailedExceptions =
Copy link
Contributor

@KevinRansom KevinRansom Aug 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps AutoOpen to eliminate all of the opens? It seems like these are generally applicable.

@KevinRansom
Copy link
Contributor

The changes look good, I left a few comments to consider.

Both @forki and @dsyme complain whenever I do these opportunistic cleanups within a PR that does a specific change. Note: I personally don't mind it honest.

When the opportunistic cleanup is extensive like it is in this PR they both submit them as separate cleanup PRs. Don't change this one ... but next time if you see a cleanup harvest just submit it as a separate cleanup only PR.

Thanks for taking care of this

Kevin

@cloudRoutine
Copy link
Contributor Author

I'll keep the cleanup in mind for future work, thanks for the review

@cloudRoutine
Copy link
Contributor Author

btw I made all the changes you suggested

@KevinRansom
Copy link
Contributor

@cloudRoutine
Thank you for taking care of this.

Kevin

@KevinRansom KevinRansom merged commit 062d672 into dotnet:master Aug 25, 2016
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.

4 participants