Skip to content

Commit

Permalink
update header
Browse files Browse the repository at this point in the history
  • Loading branch information
laves committed Nov 24, 2023
1 parent 46be150 commit 8f4f933
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions include/picovoice.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ typedef enum {
*/
PV_API const char *pv_status_to_string(pv_status_t status);

/**
* If a function returns a failure (any pv_status_t other than PV_STATUS_SUCCESS), this function can be called
* to get a series of error messages related to the failure. This function can only be called only once per
* failure status on another function. The memory for `message_stack` must be freed using `pv_free_error_stack`.
*
* Regardless of the return status of this function, if `message_stack` is not `NULL`, then `message_stack`
* contains valid memory. However, a failure status on this function indicates that future error messages
* may not be reported.
*
* @param[out] message_stack Array of messages relating to the failure. Messages are NULL terminated strings.
* The array and messages must be freed using `pv_free_error_stack`.
* @param[out] message_stack_depth The number of messages in the `message_stack` array.
*/
PV_API pv_status_t pv_get_error_stack(
char ***message_stack,
int32_t *message_stack_depth);

/**
* This function frees the memory used by error messages allocated by `pv_get_error_stack`.
*
* @param message_stack Array of messages relating to the failure, allocated from `pv_get_error_stack`.
*/
PV_API void pv_free_error_stack(char **message_stack);

#ifdef __cplusplus
}

Expand Down

0 comments on commit 8f4f933

Please sign in to comment.