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

Add Throws for exceptions to the docs #795

Merged
merged 11 commits into from Apr 30, 2024

Conversation

304NotModified
Copy link
Contributor

@304NotModified 304NotModified commented Apr 24, 2024

It's confusing that the docs talk about using .Returns, while we have .Throws (not sure from which version)

Not sure what I should do with the date in de post name. Should I update it?

(Please squash on merge PR)

Fixes #750

@304NotModified
Copy link
Contributor Author

I dont know how to fix the compilation (because of the needed using)

@304NotModified
Copy link
Contributor Author

I think I fixed it. But not sure if it's the best way.

@304NotModified
Copy link
Contributor Author

304NotModified commented Apr 25, 2024

I'm now confused, we have Throw and Throws, and both have the comments:

   /// <summary>Throw the specified exception when called.</summary>

and

<summary>Throw an exception for this call.</summary>

@dtchepak
Copy link
Member

I'm now confused, we have Throw and Throws, and both have the comments:

   /// <summary>Throw the specified exception when called.</summary>

and

<summary>Throw an exception for this call.</summary>

Throw is part of WhenCalled, so it's meant to read as "when Xyz is called do ABC and throw DEF". When stubbing a call it reads "call ABC returns ABC / throws DEF".

Copy link
Member

@dtchepak dtchepak left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the doc updates! 🙇

Left some minor comments before we merge.

docs/help/_posts/2010-05-02-throwing-exceptions.markdown Outdated Show resolved Hide resolved
docs/help/_posts/2010-05-02-throwing-exceptions.markdown Outdated Show resolved Hide resolved
```

### Returns
Another way is to use the underlying method, `.Returns`. See also [Callbacks](/help/callbacks)
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: missing trailing full stop.

See also [Callbacks](/help/callbacks).

@dtchepak dtchepak merged commit 1f2fb0f into nsubstitute:main Apr 30, 2024
12 checks passed
@304NotModified 304NotModified deleted the patch-1 branch April 30, 2024 14:07
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.

Missing/Old explanation in documentation for exception extensions
2 participants