You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- That's a good point about people ignoring return values. Sure, an exception can be caught and ignored too but I think the idea of an exception being thrown suggests that something happened that wasn't expected - such as the API being down or the shipment failing for some other reason.Lock– Lock2017-05-27 02:34:54 +00:00Commented May 27, 2017 at 2:34
- @Lock Yes, exceptions can be caught and ignored. The primary difference is that the person calling the method with a return code needs to write code to handle success or failure, while the person calling the method needs to do nothing. If it works the next line will be executed but if it fails the exception continues. It takes work to ignore exceptions, but no work to ignore return codes. That's a good point and really at the heart of my answer.Andy– Andy2017-05-27 13:27:54 +00:00Commented May 27, 2017 at 13:27
- @Lock However, an API being down unexpectedly doesn't really factor into the choice of throwing an exception or not. Its a design choice you make when you create the method. You may have an UpdateCache method that calls the API, and your design depends on the cache being updated to succeed. In that case, your method might throw if the API is down. But it could also be that your cache is a cache and for your design its ok if you use cached data which is a bit stale. In that case UpdateCache might try the API if it fails the caller won't know, because that's how the method was designed.Andy– Andy2017-05-27 13:31:42 +00:00Commented May 27, 2017 at 13:31
- @Lock So it really boils down to what decision did the programmer make when they created the methods contract. Hopefully the decision is documented somewhere too. :-)Andy– Andy2017-05-27 13:32:30 +00:00Commented May 27, 2017 at 13:32
- 1@Andy Hopefully the decision isn't just documented somewhere but where you can actually find it.gnasher729– gnasher7292017-05-27 19:17:24 +00:00Commented May 27, 2017 at 19:17
| Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-cs