wendy / com.levibostian.wendy.service / Wendy / recordError

recordError

fun recordError(taskId: Long, humanReadableErrorMessage: String?, errorId: String?): Unit

If you encounter an error while executing PendingTask.runTask in one of your PendingTasks, you can record it here to handle later in your app. This is usually used when your PendingTask encounters an error that requires the app user to fix (example: A string sent up to your API is too long. The user must shorten it up).

Parameters

taskId - The PendingTask.taskId for the PendingTask that encountered an error.

humanReadableErrorMessage - A human readable error message that you may choose to show in the UI of your app. This message describes the error to the end user. Make sure they can understand it so they can resolve their issue.

errorId - An ID identifying this error to Wendy. This exists for you, the developer. If and when the user of your app decides to fix the error, you can use this ID to determine what it was that was broken so you can show a UI to the user to fix the issue. Example: An errorId of "CreateGroceryItem" in your app could map to a UI in your app that shows the text of the entered grocery store item and the option for your user to edit it.

Exceptions

IllegalArgumentException - If the PendingTask for the taskId provided does not exist. This should only happen if you (1) never added the PendingTask to Wendy in the first place or (2) the PendingTask ran, and was successful (then you should never have recorded an error in the first place).