chromium/remoting/base/errors.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/base/errors.h"

#include "remoting/base/name_value_map.h"
#include "remoting/proto/error_code.pb.h"

namespace remoting {

namespace {

const NameMapElement<ErrorCode> kErrorCodeNames[] = {
    {ErrorCode::OK, "OK"},
    {ErrorCode::PEER_IS_OFFLINE, "PEER_IS_OFFLINE"},
    {ErrorCode::SESSION_REJECTED, "SESSION_REJECTED"},
    {ErrorCode::INCOMPATIBLE_PROTOCOL, "INCOMPATIBLE_PROTOCOL"},
    {ErrorCode::AUTHENTICATION_FAILED, "AUTHENTICATION_FAILED"},
    {ErrorCode::INVALID_ACCOUNT, "INVALID_ACCOUNT"},
    {ErrorCode::CHANNEL_CONNECTION_ERROR, "CHANNEL_CONNECTION_ERROR"},
    {ErrorCode::SIGNALING_ERROR, "SIGNALING_ERROR"},
    {ErrorCode::SIGNALING_TIMEOUT, "SIGNALING_TIMEOUT"},
    {ErrorCode::HOST_OVERLOAD, "HOST_OVERLOAD"},
    {ErrorCode::MAX_SESSION_LENGTH, "MAX_SESSION_LENGTH"},
    {ErrorCode::HOST_CONFIGURATION_ERROR, "HOST_CONFIGURATION_ERROR"},
    {ErrorCode::ELEVATION_ERROR, "ELEVATION_ERROR"},
    {ErrorCode::HOST_CERTIFICATE_ERROR, "HOST_CERTIFICATE_ERROR"},
    {ErrorCode::HOST_REGISTRATION_ERROR, "HOST_REGISTRATION_ERROR"},
    {ErrorCode::UNKNOWN_ERROR, "UNKNOWN_ERROR"},
    {ErrorCode::EXISTING_ADMIN_SESSION, "EXISTING_ADMIN_SESSION"},
    {ErrorCode::AUTHZ_POLICY_CHECK_FAILED, "AUTHZ_POLICY_CHECK_FAILED"},
    {ErrorCode::DISALLOWED_BY_POLICY, "DISALLOWED_BY_POLICY"},
    {ErrorCode::LOCATION_AUTHZ_POLICY_CHECK_FAILED,
     "LOCATION_AUTHZ_POLICY_CHECK_FAILED"},
    {ErrorCode::UNAUTHORIZED_ACCOUNT, "UNAUTHORIZED_ACCOUNT"},
    {ErrorCode::REAUTHZ_POLICY_CHECK_FAILED, "REAUTHZ_POLICY_CHECK_FAILED"},
    {ErrorCode::NO_COMMON_AUTH_METHOD, "NO_COMMON_AUTH_METHOD"},
};

}  // namespace

const char* ErrorCodeToString(ErrorCode error) {}

bool ParseErrorCode(const std::string& name, ErrorCode* result) {}

proto::ErrorCode ErrorCodeToProtoEnum(ErrorCode error) {}

}  // namespace remoting