aboutsummaryrefslogtreecommitdiffstats
path: root/slobrok/src/vespa/slobrok/server/ok_state.h
blob: 0332329edef940ba7c249f54f2011e1350fb74dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <cstdint>
#include <string>

namespace slobrok {

/**
 * @struct OkState
 * @brief object representing the result status of a request
 *
 * Contains an error code (0 means success) and an error message string.
 **/
struct OkState
{
    const uint32_t    errorCode;
    const std::string errorMsg;

    OkState(uint32_t code, std::string msg) : errorCode(code), errorMsg(msg) {}
    OkState() : errorCode(0), errorMsg() {}
    bool ok() const { return errorCode == 0; }
    bool failed() const { return errorCode != 0; }
    enum SpecialErrorCodes {
        ALL_OK = 0,
        FAILED = 1,
        FAILED_BAD = 13
    };
};

} // namespace slobrok