failure sends the payload to the Runtime API. This marks the function's invoke as a failure. Notes: - The execution of the function process continues, and is billed, until next() is called again! - A Lambda Function continues to be re-used for future invokes even after a failure. If the error is fat
(body io.Reader, contentType string, causeForXRay []byte)
| 79 | // - A Lambda Function continues to be re-used for future invokes even after a failure. |
| 80 | // If the error is fatal (panic, unrecoverable state), exit the process immediately after calling failure() |
| 81 | func (i *invoke) failure(body io.Reader, contentType string, causeForXRay []byte) error { |
| 82 | defer i.client.pool.Put(i.payload) |
| 83 | defer i.payload.Reset() |
| 84 | |
| 85 | url := i.client.baseURL + i.id + "/error" |
| 86 | return i.client.post(url, body, contentType, causeForXRay) |
| 87 | } |
| 88 | |
| 89 | // next connects to the Runtime API and waits for a new invoke Request to be available. |
| 90 | // Note: After a call to Done() or Error() has been made, a call to next() will complete the in-flight invoke. |