Volley 이상 설명
                                            
 6070 단어  exceptionVolleyvolleyerro
                    
예외 종류(VolleyError)
ServerError 의 경우
1.entity가 비어 있습니다.
InputStream in = entity.getContent(); if (in == null) { throw new ServerError(); }
2. 5xx 반환
//TODO: Only throw ServerError for 5xx status codes. throw new ServerError(networkResponse);
TimeoutError
1.SocketTimeoutException
attemptRetryOnException(“socket”, request, new TimeoutError());
2.ConnectTimeoutException
attemptRetryOnException(“connection”, request, new TimeoutError());
RedirectError
statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY
ParseError
/** * Subclasses must implement this to parse the raw network response * and return an appropriate response type. This method will be * called from a worker thread. The response will not be delivered * if you return null. * @param response Response from the network * @return The parsed response, or null in the case of an error */
    abstract protected Response<T> parseNetworkResponse(NetworkResponse response);  AuthFailureError
/** * An Authenticator that uses {@link AccountManager} to get auth * tokens of a specified type for a specified account. */
public class AndroidAuthenticator implements Authenticator    // TODO: Figure out what to do about notifyAuthFailure
@SuppressWarnings("deprecation")
@Override
public String getAuthToken() throws AuthFailureError {
    AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount,
            mAuthTokenType, mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }
    return authToken;
}  if (responseContents != null) {
    networkResponse = new NetworkResponse(statusCode, responseContents,
            responseHeaders, false, SystemClock.elapsedRealtime() - requestStart);
    if (statusCode == HttpStatus.SC_UNAUTHORIZED ||
            statusCode == HttpStatus.SC_FORBIDDEN) {
        attemptRetryOnException("auth",
                request, new AuthFailureError(networkResponse));
    } else if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || 
                statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
        attemptRetryOnException("redirect",
                request, new RedirectError(networkResponse));
    } else {
        // TODO: Only throw ServerError for 5xx status codes.
        throw new ServerError(networkResponse);
    }
} else {
    throw new NetworkError(e);
}  NetworkError
httpResponse = mHttpStack.performRequest(request, headers);
throw IOException  NoNConnectionException
NetworkResponse networkResponse = null;
if (httpResponse != null) {
    statusCode = httpResponse.getStatusLine().getStatusCode();
} else {
    throw new NoConnectionError(e);
}
                이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Exception Class에서 에러 코드 해석 ~초기초편~직장에서 C# 프로젝트가 내뿜는 오류 코드를 구문 분석하고 오류의 위치를 확인하기 위해 Exception class를 활용할 수 있었습니다. 지금까지 Exception Class 에 대해서 별로 파악할 수 없었기 때...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.