File Coverage

src/panda/protocol/websocket/Error.h
Criterion Covered Total %
statement 1 1 100.0
branch 1 2 50.0
condition n/a
subroutine n/a
pod n/a
total 2 3 66.6


line stmt bran cond sub pod time code
1             #pragma once
2             #include
3             #include
4             #include
5              
6             namespace panda { namespace protocol { namespace websocket {
7              
8             extern const std::error_category& error_category;
9             extern log::Module panda_log_module;
10              
11             enum class errc {
12             garbage_after_connect = 1,
13             unsupported_version,
14             response_code_101,
15             connection_mustbe_upgrade,
16             upgrade_mustbe_websocket,
17             sec_accept_missing,
18             method_mustbe_get,
19             http_1_1_required,
20             body_prohibited,
21             invalid_opcode,
22             control_fragmented,
23             control_payload_too_big,
24             not_masked,
25             max_frame_size,
26             max_message_size,
27             close_frame_invalid_data,
28             initial_continue,
29             fragment_no_continue,
30             deflate_negotiation_failed,
31             control_frame_compression,
32             inflate_error,
33             unexpected_rsv,
34             invalid_utf8,
35             };
36              
37 72 50         struct ErrorCategory : std::error_category {
38             const char* name () const noexcept override;
39             std::string message (int ev) const override;
40             };
41              
42             inline std::error_code make_error_code (errc err) noexcept {
43             return std::error_code(int(err), error_category);
44             }
45              
46             struct Error : panda::exception {
47             using exception::exception;
48             };
49              
50             }}}
51              
52             namespace std {
53             template <> struct is_error_code_enum : std::true_type {};
54             }