Turi Create
4.0
lambda_utils.hpp
1
/* Copyright © 2017 Apple Inc. All rights reserved.
2
*
3
* Use of this source code is governed by a BSD-3-clause license that can
4
* be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5
*/
6
#ifndef TURI_LAMBDA_LAMBDA_UTILS_HPP
7
#define TURI_LAMBDA_LAMBDA_UTILS_HPP
8
9
#include<core/system/cppipc/common/message_types.hpp>
10
11
namespace
turi
{
12
namespace
lambda {
13
14
/**
15
* Helper function to convert an communication failure exception to a user
16
* friendly message indicating a failure lambda execution.
17
*/
18
inline
cppipc::ipcexception reinterpret_comm_failure(cppipc::ipcexception e) {
19
const
char
* message =
"Fail executing the lambda function. The lambda worker may have run out of memory or crashed because it captured objects that cannot be properly serialized."
;
20
if
(e.get_reply_status() ==
cppipc::reply_status::COMM_FAILURE
) {
21
return
cppipc::ipcexception(
cppipc::reply_status::EXCEPTION
,
22
e.get_zeromq_errorcode(),
23
message);
24
}
else
{
25
return
e;
26
}
27
}
28
29
}
30
}
31
32
#endif
cppipc::reply_status::EXCEPTION
Other general exception. Body will contain the exception message.
cppipc::reply_status::COMM_FAILURE
Communication error.
turi
SKD.
Definition:
capi_initialization.hpp:11
core
system
lambda
lambda_utils.hpp
Generated by
1.8.13