Errors

Types

class cepton_sdk::SensorError : public runtime_error

Error returned by most functions.

Implicitly convertible from/to SensorErrorCode. Getter functions do not return an error, because they cannot fail. Will call CEPTON_ASSERT if nonzero error is not used (call ignore to manually use error).

Public Functions

SensorError(SensorErrorCode code, const std::string &msg)

Create SensorError class object with SensorErrorCode and error message.

SensorError(SensorErrorCode code)

Create SensorError class object with error code.

SensorError()

SensorError class default constructor.

~SensorError()

SensorError class destructor.

SensorError(const SensorError &other)

Create SensorError object using SensorError object.

SensorError &operator=(const SensorError &other)

SensorError class assignment operator.

bool used() const

Internal use only.

const SensorError &ignore() const

Mark error as used.

const char * what () const noexceptoverride
const std::string &msg() const

Returns error message.

SensorErrorCode code() const

Returns error code.

operator SensorErrorCode() const

Implicitly convert to SensorErrorCode.

operator bool() const

Returns false if error code is CEPTON_SUCCESS, true otherwise.

const std::string name() const

Returns error code name.

bool is_error() const

Returns true if parent object is an error.

bool is_fault() const

Returns true if parent object is a fault.

typedef int32_t CeptonSensorErrorCode

Error code returned by most library functions.

Must call cepton_sdk_get_error if nonzero error code is returned.

enum _CeptonSensorErrorCode

Values:

enumerator CEPTON_SUCCESS

No error.

enumerator CEPTON_ERROR_GENERIC

Generic error.

enumerator CEPTON_ERROR_OUT_OF_MEMORY

Failed to allocate heap memory.

enumerator CEPTON_ERROR_SENSOR_NOT_FOUND

Could not find sensor.

enumerator CEPTON_ERROR_SDK_VERSION_MISMATCH

SDK version mismatch.

enumerator CEPTON_ERROR_COMMUNICATION

Networking error.

enumerator CEPTON_ERROR_TOO_MANY_CALLBACKS

Callback already set.

enumerator CEPTON_ERROR_INVALID_ARGUMENTS

Invalid value or uninitialized struct.

enumerator CEPTON_ERROR_ALREADY_INITIALIZED

Already initialized.

enumerator CEPTON_ERROR_NOT_INITIALIZED

Not initialized.

enumerator CEPTON_ERROR_INVALID_FILE_TYPE

Invalid file type.

enumerator CEPTON_ERROR_FILE_IO

File IO error.

enumerator CEPTON_ERROR_CORRUPT_FILE

Corrupt/invalid file.

enumerator CEPTON_ERROR_NOT_OPEN

Not open.

enumerator CEPTON_ERROR_EOF

End of file.

enumerator CEPTON_ERROR_NOT_SUPPORTED

Functionality not supported by device.

enumerator CEPTON_ERROR_INVALID_RESPONSE

Device response invalid.

enumerator CEPTON_ERROR_INVALID_STATE

Software state invalid.

enumerator CEPTON_FAULT_INTERNAL

Internal sensor parameter out of range.

enumerator CEPTON_FAULT_EXTREME_TEMPERATURE

Extreme sensor temperature fault.

enumerator CEPTON_FAULT_EXTREME_HUMIDITY

Extreme sensor humidity fault.

enumerator CEPTON_FAULT_EXTREME_ACCELERATION

Extreme sensor acceleration fault.

enumerator CEPTON_FAULT_SCAN_COVERAGE

Abnormal sensor FOV fault.

enumerator CEPTON_FAULT_ABNORMAL_FRAME_RATE

Abnormal sensor frame rate fault.

enumerator CEPTON_FAULT_MOTOR_MALFUNCTION

Sensor motor malfunction fault.

enumerator CEPTON_FAULT_LASER_MALFUNCTION

Sensor laser malfunction fault.

enumerator CEPTON_FAULT_DETECTOR_MALFUNCTION

Sensor detector malfunction fault.

Methods

const char *cepton_get_error_code_name(CeptonSensorErrorCode error_code)

Returns error code name string.

Returns empty string if error code is invalid.

Return

Error code name string. Owned by SDK. Valid until next SDK call in current thread.

int cepton_is_error_code(CeptonSensorErrorCode error_code)

Returns whether error_code is of the form CEPTON_ERROR_*.

int cepton_is_fault_code(CeptonSensorErrorCode error_code)

Returns whether error_code is of the form CEPTON_FAULT_*.

CeptonSensorErrorCode cepton_sdk_get_error(const char **error_msg)

Returns and clears last sdk error.

Return

Error code.

Parameters
  • error_msg: Returned error message string. Owned by the SDK, and valid until next SDK call in the current thread.