Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
status.h File Reference

A11's error type and its protocol/JSON bridges. More...

#include <cstdint>
#include <string>
#include <string_view>
#include <absl/status/status.h>
#include <absl/status/statusor.h>
#include <nlohmann/json_fwd.hpp>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  symbian
 

Functions

absl::StatusCode symbian::StatusCodeFromHttp (int http_code)
 Maps an HTTP status code to a canonical status code.
 
int symbian::StatusCodeToHttp (absl::StatusCode code)
 Maps a canonical status code to its HTTP status code.
 
absl::StatusCode symbian::StatusCodeFromWebSocket (std::uint16_t close_code)
 Maps a WebSocket close code to a canonical status code.
 
std::uint16_t symbian::StatusCodeToWebSocket (absl::StatusCode code)
 Maps a canonical status code to its WebSocket close code.
 
absl::Status symbian::MakeStatus (absl::StatusCode code, const std::string &message, const nlohmann::json &details)
 Builds a status carrying an A11 structured-details payload.
 
nlohmann::json symbian::StatusDetails (const absl::Status &status)
 Extracts the structured-details payload from a status.
 
absl::StatusOr< nlohmann::json > symbian::StatusToJson (const absl::Status &status)
 Serializes a status (code, message, details) to JSON.
 
nlohmann::json symbian::StatusToJsonOrEmptyDetails (const absl::Status &status)
 Serializes a status to JSON, never failing.
 
absl::StatusOr< absl::Status > symbian::StatusFromJson (const nlohmann::json &value)
 Reconstructs a status from its JSON representation.
 

Variables

constexpr std::string_view symbian::kStatusDetailsPayloadUrl
 Type URL identifying A11's status-details payload.
 

Detailed Description

A11's error type and its protocol/JSON bridges.

A11 uses Abseil's absl::Status (and the canonical absl::StatusCode enumeration) as its error carrier rather than defining a bespoke type. This header adds the pieces A11 layers on top: mappings between status codes and the HTTP and WebSocket close codes that form part of the public wire contract, and helpers that carry A11's optional structured "details" payload through JSON (and, via JSON, MessagePack) round-trips.