determineHTTPStatusCode maps error codes to HTTP status codes
(code int)
| 146 | |
| 147 | // determineHTTPStatusCode maps error codes to HTTP status codes |
| 148 | func determineHTTPStatusCode(code int) int { |
| 149 | switch code { |
| 150 | case SuccessCode: |
| 151 | return http.StatusOK |
| 152 | case ServerErrorCode: |
| 153 | return http.StatusInternalServerError |
| 154 | case InvalidParamsCode: |
| 155 | return http.StatusBadRequest |
| 156 | case NotFoundCode: |
| 157 | return http.StatusNotFound |
| 158 | case UnauthorizedAuthNotExistErrorCode, |
| 159 | UnauthorizedTokenErrorCode, |
| 160 | UnauthorizedTokenGenerateErrorCode, |
| 161 | UnauthorizedTokenTimeoutErrorCode: |
| 162 | return http.StatusUnauthorized |
| 163 | case TooManyRequestsCode: |
| 164 | return http.StatusTooManyRequests |
| 165 | default: |
| 166 | return http.StatusInternalServerError |
| 167 | } |
| 168 | } |
no outgoing calls
no test coverage detected