mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 19:03:33 +08:00
Meaningful error codes instead of plain -1
This commit is contained in:
@@ -84,7 +84,7 @@ void DataTypeInfoProvider::handleGetDataTypeInfoRequest(const protocol::GetDataT
|
||||
|
||||
int DataTypeInfoProvider::start()
|
||||
{
|
||||
int res = -1;
|
||||
int res = 0;
|
||||
|
||||
res = cats_srv_.start(
|
||||
ComputeAggregateTypeSignatureCallback(this, &DataTypeInfoProvider::handleComputeAggregateTypeSignatureRequest));
|
||||
|
||||
@@ -108,12 +108,12 @@ int GlobalTimeSyncMaster::init()
|
||||
GlobalDataTypeRegistry::instance().find(DataTypeKindMessage, protocol::GlobalTimeSync::getDataTypeFullName());
|
||||
if (desc == NULL)
|
||||
{
|
||||
return -1;
|
||||
return -ErrUnknownDataType;
|
||||
}
|
||||
dtid_ = desc->getID();
|
||||
|
||||
// Iface master array
|
||||
int res = -1;
|
||||
int res = -ErrLogic;
|
||||
for (uint8_t i = 0; i < MaxCanIfaces; i++)
|
||||
{
|
||||
if (!iface_masters_[i].isConstructed())
|
||||
|
||||
@@ -105,7 +105,7 @@ int NodeInitializer::checkOneNodeOneDataTypeKind(NodeID nid, DataTypeKind kind)
|
||||
}
|
||||
if (!last_cats_request_ok_)
|
||||
{
|
||||
return -1;
|
||||
return -ErrFailure;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -59,15 +59,13 @@ void NodeStatusProvider::handleGetNodeInfoRequest(const protocol::GetNodeInfo::R
|
||||
|
||||
int NodeStatusProvider::startAndPublish()
|
||||
{
|
||||
int res = -1;
|
||||
|
||||
if (!isNodeInfoInitialized())
|
||||
{
|
||||
UAVCAN_TRACE("NodeStatusProvider", "Node info was not initialized");
|
||||
return -1;
|
||||
return -ErrNotInited;
|
||||
}
|
||||
|
||||
res = publish(); // Initial broadcast
|
||||
int res = publish(); // Initial broadcast
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
|
||||
@@ -73,7 +73,7 @@ int ParamServer::start(IParamManager* manager)
|
||||
{
|
||||
if (manager == NULL)
|
||||
{
|
||||
return -1;
|
||||
return -ErrInvalidParam;
|
||||
}
|
||||
manager_ = manager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user