Skip to content

Commit 9fabc7b

Browse files
committed
[onert] Add API function for retrieving last error message
This commit adds dedicated API function nnfw_get_last_error_message() for retrieving last error message in case when other functions return status code other than NNFW_STATUS_NO_ERROR. ONE-DCO-1.0-Signed-off-by: Arkadiusz Bokowy <a.bokowy@samsung.com>
1 parent d9dc857 commit 9fabc7b

5 files changed

Lines changed: 378 additions & 218 deletions

File tree

runtime/onert/api/nnfw/include/nnfw.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,19 @@ NNFW_STATUS nnfw_create_session(nnfw_session **session);
212212
*/
213213
NNFW_STATUS nnfw_close_session(nnfw_session *session);
214214

215+
/**
216+
* @brief Get the last error message
217+
*
218+
* This function retrieves the last error message occurred in the session.
219+
*
220+
* @param[in] session The session to get the last error message from
221+
* @param[out] buffer Buffer to store the last error message string
222+
* @param[in] length The size of the buffer
223+
* @return @c NNFW_STATUS_NO_ERROR if successful, otherwise appropriate
224+
* error code and the content of buffer is not changed.
225+
*/
226+
NNFW_STATUS nnfw_get_last_error_message(nnfw_session *session, char *buffer, size_t length);
227+
215228
/**
216229
* @brief Load model from path to model or nnpackage
217230
*

runtime/onert/api/nnfw/src/APIImpl.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ NNFW_STATUS nnfw_close_session(nnfw_session *session)
6969
return NNFW_STATUS_NO_ERROR;
7070
}
7171

72+
NNFW_STATUS nnfw_get_last_error_message(nnfw_session *session, char *buffer, size_t length)
73+
{
74+
NNFW_RETURN_ERROR_IF_NULL(session);
75+
return reinterpret_cast<Session *>(session)->get_last_error_message(buffer, length);
76+
}
77+
7278
NNFW_STATUS nnfw_load_model_from_file(nnfw_session *session, const char *path)
7379
{
7480
NNFW_RETURN_ERROR_IF_NULL(session);

0 commit comments

Comments
 (0)