proxygen
ErrorCode.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <cstdint>
13 
14 #define RETURN_IF_ERROR(err) \
15  if (err != ErrorCode::NO_ERROR) { \
16  VLOG(4) << "Returning with error=" << getErrorCodeString(err); \
17  return err; \
18  }
19 
20 namespace proxygen {
21 
22 // Error codes are 32-bit fields that are used in RST_STREAM and GOAWAY
23 // frames to convey the reasons for the stream or connection error.
24 
25 // We only need <1 byte to represent it in memory
26 enum class ErrorCode: uint8_t {
27  NO_ERROR = 0,
28  PROTOCOL_ERROR = 1,
29  INTERNAL_ERROR = 2,
31  SETTINGS_TIMEOUT = 4,
32  STREAM_CLOSED = 5,
33  FRAME_SIZE_ERROR = 6,
34  REFUSED_STREAM = 7,
35  CANCEL = 8,
37  CONNECT_ERROR = 10,
38  ENHANCE_YOUR_CALM = 11,
40  HTTP_1_1_REQUIRED = 13,
41  // This code is *NOT* to be used outside of SPDYCodec. Delete this
42  // when we deprecate SPDY.
44 };
45 
46 extern const uint8_t kMaxErrorCode;
47 
51 extern const char* getErrorCodeString(ErrorCode error);
52 
53 }
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
const char * getErrorCodeString(ErrorCode error)
Definition: ErrorCode.cpp:18
const uint8_t kMaxErrorCode
Definition: ErrorCode.cpp:16