github.com/ooni/psiphon/tunnel-core@v0.0.0-20230105123940-fe12a24c96ee/oovendor/quic-go/http3/error_codes.go (about)

     1  package http3
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/ooni/psiphon/tunnel-core/oovendor/quic-go"
     7  )
     8  
     9  type errorCode quic.ApplicationErrorCode
    10  
    11  const (
    12  	errorNoError              errorCode = 0x100
    13  	errorGeneralProtocolError errorCode = 0x101
    14  	errorInternalError        errorCode = 0x102
    15  	errorStreamCreationError  errorCode = 0x103
    16  	errorClosedCriticalStream errorCode = 0x104
    17  	errorFrameUnexpected      errorCode = 0x105
    18  	errorFrameError           errorCode = 0x106
    19  	errorExcessiveLoad        errorCode = 0x107
    20  	errorIDError              errorCode = 0x108
    21  	errorSettingsError        errorCode = 0x109
    22  	errorMissingSettings      errorCode = 0x10a
    23  	errorRequestRejected      errorCode = 0x10b
    24  	errorRequestCanceled      errorCode = 0x10c
    25  	errorRequestIncomplete    errorCode = 0x10d
    26  	errorMessageError         errorCode = 0x10e
    27  	errorConnectError         errorCode = 0x10f
    28  	errorVersionFallback      errorCode = 0x110
    29  )
    30  
    31  func (e errorCode) String() string {
    32  	switch e {
    33  	case errorNoError:
    34  		return "H3_NO_ERROR"
    35  	case errorGeneralProtocolError:
    36  		return "H3_GENERAL_PROTOCOL_ERROR"
    37  	case errorInternalError:
    38  		return "H3_INTERNAL_ERROR"
    39  	case errorStreamCreationError:
    40  		return "H3_STREAM_CREATION_ERROR"
    41  	case errorClosedCriticalStream:
    42  		return "H3_CLOSED_CRITICAL_STREAM"
    43  	case errorFrameUnexpected:
    44  		return "H3_FRAME_UNEXPECTED"
    45  	case errorFrameError:
    46  		return "H3_FRAME_ERROR"
    47  	case errorExcessiveLoad:
    48  		return "H3_EXCESSIVE_LOAD"
    49  	case errorIDError:
    50  		return "H3_ID_ERROR"
    51  	case errorSettingsError:
    52  		return "H3_SETTINGS_ERROR"
    53  	case errorMissingSettings:
    54  		return "H3_MISSING_SETTINGS"
    55  	case errorRequestRejected:
    56  		return "H3_REQUEST_REJECTED"
    57  	case errorRequestCanceled:
    58  		return "H3_REQUEST_CANCELLED"
    59  	case errorRequestIncomplete:
    60  		return "H3_INCOMPLETE_REQUEST"
    61  	case errorMessageError:
    62  		return "H3_MESSAGE_ERROR"
    63  	case errorConnectError:
    64  		return "H3_CONNECT_ERROR"
    65  	case errorVersionFallback:
    66  		return "H3_VERSION_FALLBACK"
    67  	default:
    68  		return fmt.Sprintf("unknown error code: %#x", uint16(e))
    69  	}
    70  }