Skip to content

Commit 1bfe7b2

Browse files
New error code: Offline
Used to indicate absence of network connectivity Relates-To: OCMAM-420 Signed-off-by: Andrey Kashcheev <ext-andrey.kashcheev@here.com>
1 parent 0006cd2 commit 1bfe7b2

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

olp-cpp-sdk-core/include/olp/core/client/ApiError.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2024 HERE Europe B.V.
2+
* Copyright (C) 2019-2025 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -109,6 +109,18 @@ class CORE_API ApiError {
109109
return {ErrorCode::CacheIO, description};
110110
}
111111

112+
/**
113+
* @brief Creates the `ApiError` instance with the offline error code and
114+
* description.
115+
*
116+
* @param description The optional description.
117+
*
118+
* @return The `ApiError` instance.
119+
*/
120+
static ApiError Offline(const char* description = "Offline") {
121+
return {ErrorCode::Offline, description};
122+
}
123+
112124
/**
113125
* @brief Creates the `ApiError` instance with the unknown error code and
114126
* description.

olp-cpp-sdk-core/include/olp/core/client/ErrorCode.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2024 HERE Europe B.V.
2+
* Copyright (C) 2019-2025 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -96,6 +96,11 @@ enum class ErrorCode {
9696
* The device is full and cannot store more data.
9797
*/
9898
NoSpaceLeft,
99+
100+
/**
101+
* Absence of network connectivity.
102+
*/
103+
Offline,
99104
};
100105

101106
} // namespace client

olp-cpp-sdk-core/include/olp/core/http/HttpStatusCode.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2021 HERE Europe B.V.
2+
* Copyright (C) 2019-2025 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -154,6 +154,7 @@ class CORE_API HttpStatusCode {
154154
if (http_code < 0) {
155155
switch (static_cast<olp::http::ErrorCode>(http_code)) {
156156
case olp::http::ErrorCode::OFFLINE_ERROR:
157+
return olp::client::ErrorCode::Offline;
157158
case olp::http::ErrorCode::IO_ERROR:
158159
return olp::client::ErrorCode::NetworkConnection;
159160
case olp::http::ErrorCode::TIMEOUT_ERROR:

0 commit comments

Comments
 (0)