-
Notifications
You must be signed in to change notification settings - Fork 31
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
docs: add section on error values to resource author's guide #347
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,20 @@ these rules: | |
1. Otherwise, if there are any diffs which say that they contain a difference, | ||
the Status will always show as having changes. | ||
|
||
### Dealing with Errors | ||
|
||
The default `Status` implementation has a `SetError(error)` method. When called, | ||
it sets an appropriate error level and an internal error state that will be | ||
presented to the user. You can also use the common Go patterm of returning `nil, | ||
err` in your `Check` and `Apply` statements. Converge will call `SetError(err)` | ||
automatically in this case. This gives you two options: | ||
|
||
1. call `SetError` yourself. | ||
1. return an error, which will be handled for you. | ||
|
||
You shoud choose *one* of these options and do it consistently across as much of | ||
your code as possible. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fyi, until #345 is merged, your error can be lost (regardless of whether you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll consider that a blocker for this. |
||
## Preparer | ||
|
||
Before you can use your resource, it has to be deserialized from HCL. For this, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you also return the error if you call SetError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I've added a section to clarify in ebd589c