// Path: src/main/java/com/qcloud/cos/http/ResponseBodyKey.java
// public class ResponseBodyKey {
//     public static final String CODE = "code";
//     public static final String MESSAGE = "message";
//     public static final String DATA = "data";
// 
//     public class Data {
//         public static final String SESSION = "session";
//         public static final String OFFSET = "offset";
//         public static final String SLICE_SIZE = "slice_size";
//         public static final String ACCESS_URL = "access_url";
//         public static final String URL = "url";
//         public static final String RESOURCE_PATH = "resource_path";
//         public static final String NAME = "name";
//         public static final String BIZ_ATTR = "biz_attr";
//         public static final String FILESIZE = "filesize";
//         public static final String SHA = "sha";
//         public static final String CTIME = "ctime";
//         public static final String MTIME = "mtime";
//     }
// }


import org.json.JSONObject;
import com.qcloud.cos.http.ResponseBodyKey;
package com.qcloud.cos.exception;



/**
 * 封装cos异常
 * @author chengwu
 *
 */
public abstract class AbstractCosException extends Exception {

    private static final long serialVersionUID = 7547532865194837136L;
    
    private CosExceptionType type;

    public AbstractCosException(CosExceptionType type, String message) {
        super(message);
        this.type = type;
    }

    public CosExceptionType getType() {
        return type;
    }
    
    @Override
    public String toString() {
        JSONObject responseObj = new JSONObject();
// Path: src/main/java/com/qcloud/cos/http/ResponseBodyKey.java
// public class ResponseBodyKey {
//     public static final String CODE = "code";
//     public static final String MESSAGE = "message";
//     public static final String DATA = "data";
// 
//     public class Data {
//         public static final String SESSION = "session";
//         public static final String OFFSET = "offset";
//         public static final String SLICE_SIZE = "slice_size";
//         public static final String ACCESS_URL = "access_url";
//         public static final String URL = "url";
//         public static final String RESOURCE_PATH = "resource_path";
//         public static final String NAME = "name";
//         public static final String BIZ_ATTR = "biz_attr";
//         public static final String FILESIZE = "filesize";
//         public static final String SHA = "sha";
//         public static final String CTIME = "ctime";
//         public static final String MTIME = "mtime";
//     }
// }


// Path: src/main/java/com/qcloud/cos/exception/AbstractCosException.java
import org.json.JSONObject;
import com.qcloud.cos.http.ResponseBodyKey;

package com.qcloud.cos.exception;



/**
 * 封装cos异常
 * @author chengwu
 *
 */
public abstract class AbstractCosException extends Exception {

    private static final long serialVersionUID = 7547532865194837136L;
    
    private CosExceptionType type;

    public AbstractCosException(CosExceptionType type, String message) {
        super(message);
        this.type = type;
    }

    public CosExceptionType getType() {
        return type;
    }
    
    @Override
    public String toString() {
        JSONObject responseObj = new JSONObject();
        responseObj.put(ResponseBodyKey.CODE, type.getErrorCode());