/*
 * Copyright (C) 2013 Square, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package okhttp3.internal.http2;

// http://tools.ietf.org/html/draft-ietf-httpbis-http2-17#section-7
public enum ErrorCode {
  /** Not an error! */
  NO_ERROR(0),

  PROTOCOL_ERROR(1),

  INTERNAL_ERROR(2),

  FLOW_CONTROL_ERROR(3),

  REFUSED_STREAM(7),

  CANCEL(8);

  public final int httpCode;

  ErrorCode(int httpCode) {
    this.httpCode = httpCode;
  }

  public static ErrorCode fromHttp2(int code) {
    for (ErrorCode errorCode : ErrorCode.values()) {
      if (errorCode.httpCode == code) return errorCode;
    }
    return null;
  }
}

@@ -861,16 +861,147 @@
 ANCEL(8)
+,%0A%0A  COMPRESSION_ERROR(9),%0A%0A  CONNECT_ERROR(0xa),%0A%0A  ENHANCE_YOUR_CALM(0xb),%0A%0A  INADEQUATE_SECURITY(0xc),%0A%0A  HTTP_1_1_REQUIRED(0xd)
 ;%0A%0A  pub

Define all HTTP2 error codes (#3756)