Java Code Examples for com.hippo.util.ExceptionUtils#getReadableString()

The following examples show how to use com.hippo.util.ExceptionUtils#getReadableString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentLayout.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
public void onGetException(int taskId, Exception e) {
    if (mCurrentTaskId == taskId) {
        mRefreshLayout.setHeaderRefreshing(false);
        mRefreshLayout.setFooterRefreshing(false);

        String readableError;
        if (e != null) {
            e.printStackTrace();
            if (e instanceof HttpException && ((HttpException) e).code() == 401) {
                // do login
                mTipView.setOnClickListener(loginListener);
            }

            readableError = ExceptionUtils.getReadableString(e);
        } else {
            readableError = getContext().getString(R.string.error_unknown);
        }

        if (mViewTransition.getShownViewIndex() == 0) {
            Toast.makeText(getContext(), readableError, Toast.LENGTH_SHORT).show();
        } else {
            showText(readableError);
        }
    }
}
 
Example 2
Source File: ContentLayout.java    From Nimingban with Apache License 2.0 6 votes vote down vote up
public void onGetExpection(int taskId, Exception e) {
    if (mCurrentTaskId == taskId) {
        if (e != null) {
            e.printStackTrace();
        }

        mRefreshLayout.setHeaderRefreshing(false);
        mRefreshLayout.setFooterRefreshing(false);
        Say.d(TAG, "Get page data failed " + e.getClass().getName() + " " + e.getMessage());
        String readableError = ExceptionUtils.getReadableString(getContext(), e);
        String reason = ExceptionUtils.getReasonString(getContext(), e);
        if (reason != null) {
            readableError += '\n' + reason;
        }
        if (mViewTransition.getShownViewIndex() == 0) {
            Toast.makeText(getContext(), readableError, Toast.LENGTH_SHORT).show();
        } else {
            showText(readableError);
        }
    }
}
 
Example 3
Source File: ContentLayout.java    From EhViewer with Apache License 2.0 6 votes vote down vote up
public void onGetException(int taskId, Exception e) {
    if (mCurrentTaskId == taskId) {
        mRefreshLayout.setHeaderRefreshing(false);
        mRefreshLayout.setFooterRefreshing(false);

        String readableError;
        if (e != null) {
            e.printStackTrace();
            readableError = ExceptionUtils.getReadableString(e);
        } else {
            readableError = getContext().getString(R.string.error_unknown);
        }

        if (mViewTransition.getShownViewIndex() == 0) {
            Toast.makeText(getContext(), readableError, Toast.LENGTH_SHORT).show();
        } else {
            showText(readableError);
        }
    }
}
 
Example 4
Source File: GalleryDetailScene.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
private void onGetGalleryDetailFailure(Exception e) {
    e.printStackTrace();
    Context context = getContext2();
    if (null != context && null != mTip) {
        String error = ExceptionUtils.getReadableString(e);
        mTip.setText(error);
        adjustViewVisibility(STATE_FAILED, true);
    }
}
 
Example 5
Source File: ProgressScene.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
private void onGetGalleryTokenFailure(Exception e) {
    mValid = false;

    Context context = getContext2();

    if (null != context && null != mViewTransition && null != mTip) {
        // Show tip
        mError = ExceptionUtils.getReadableString(e);
        mViewTransition.showView(1);
        mTip.setText(mError);
    }
}
 
Example 6
Source File: GalleryDetailScene.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
private void onGetGalleryDetailFailure(Exception e) {
    e.printStackTrace();
    Context context = getContext2();
    if (null != context && null != mTip) {
        String error = ExceptionUtils.getReadableString(e);
        mTip.setText(error);
        adjustViewVisibility(STATE_FAILED, true);
    }
}
 
Example 7
Source File: ProgressScene.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
private void onGetGalleryTokenFailure(Exception e) {
    mValid = false;

    Context context = getContext2();

    if (null != context && null != mViewTransition && null != mTip) {
        // Show tip
        mError = ExceptionUtils.getReadableString(e);
        mViewTransition.showView(1);
        mTip.setText(mError);
    }
}