aboutsummaryrefslogtreecommitdiff
path: root/lib/olm/errors.cpp
blob: fce177c677f21c9e7cc056f6f4480400e2beb2a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "olm/errors.h"

Quotient::OlmError Quotient::fromString(const std::string &error_raw) {
    if (error_raw.compare("BAD_ACCOUNT_KEY")) {
        return OlmError::BadAccountKey;
    } else if (error_raw.compare("BAD_MESSAGE_KEY_ID")) {
        return OlmError::BadMessageKeyId;
    } else if (error_raw.compare("INVALID_BASE64")) {
        return OlmError::InvalidBase64;
    } else if (error_raw.compare("NOT_ENOUGH_RANDOM")) {
        return OlmError::NotEnoughRandom;
    } else if (error_raw.compare("OUTPUT_BUFFER_TOO_SMALL")) {
        return OlmError::OutputBufferTooSmall;
    } else {
        return OlmError::Unknown;
    }
}