diff --git a/olp-cpp-sdk-core/include/olp/core/client/ApiError.h b/olp-cpp-sdk-core/include/olp/core/client/ApiError.h index 8f09b7d1a..19b6cb7ca 100644 --- a/olp-cpp-sdk-core/include/olp/core/client/ApiError.h +++ b/olp-cpp-sdk-core/include/olp/core/client/ApiError.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 HERE Europe B.V. + * Copyright (C) 2019-2025 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,6 +109,18 @@ class CORE_API ApiError { return {ErrorCode::CacheIO, description}; } + /** + * @brief Creates the `ApiError` instance with the offline error code and + * description. + * + * @param description The optional description. + * + * @return The `ApiError` instance. + */ + static ApiError Offline(const char* description = "Offline") { + return {ErrorCode::Offline, description}; + } + /** * @brief Creates the `ApiError` instance with the unknown error code and * description. diff --git a/olp-cpp-sdk-core/include/olp/core/client/ErrorCode.h b/olp-cpp-sdk-core/include/olp/core/client/ErrorCode.h index 33563b8d4..d552c4666 100644 --- a/olp-cpp-sdk-core/include/olp/core/client/ErrorCode.h +++ b/olp-cpp-sdk-core/include/olp/core/client/ErrorCode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 HERE Europe B.V. + * Copyright (C) 2019-2025 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -96,6 +96,11 @@ enum class ErrorCode { * The device is full and cannot store more data. */ NoSpaceLeft, + + /** + * Absence of network connectivity. + */ + Offline, }; } // namespace client diff --git a/olp-cpp-sdk-core/include/olp/core/http/HttpStatusCode.h b/olp-cpp-sdk-core/include/olp/core/http/HttpStatusCode.h index e287cc141..940d6c6de 100644 --- a/olp-cpp-sdk-core/include/olp/core/http/HttpStatusCode.h +++ b/olp-cpp-sdk-core/include/olp/core/http/HttpStatusCode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 HERE Europe B.V. + * Copyright (C) 2019-2025 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -154,6 +154,7 @@ class CORE_API HttpStatusCode { if (http_code < 0) { switch (static_cast(http_code)) { case olp::http::ErrorCode::OFFLINE_ERROR: + return olp::client::ErrorCode::Offline; case olp::http::ErrorCode::IO_ERROR: return olp::client::ErrorCode::NetworkConnection; case olp::http::ErrorCode::TIMEOUT_ERROR: