Java tutorial
/******************************************************************************* * OneDrive Java API * Copyright (C) 2015 - Carlos Guzman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Created on Aug 1, 2015 * @author: Carlos Guzman (cguZZman) carlosguzmang@hotmail.com *******************************************************************************/ package com.onedrive.api.exception; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import com.onedrive.api.resource.support.ErrorResponse; public class OneDriveException extends RuntimeException { private static final long serialVersionUID = 5052702544600327914L; private ErrorResponse errorResponse; private HttpHeaders headers; private HttpStatus status; public OneDriveException(ErrorResponse errorResponse, HttpHeaders headers, HttpStatus status) { this(errorResponse, headers, status, null); } public OneDriveException(ErrorResponse errorResponse, HttpHeaders headers, HttpStatus status, Throwable cause) { super(status.value() + " [" + status.getReasonPhrase() + "] " + errorResponse.toString(), cause); this.errorResponse = errorResponse; this.headers = headers; this.status = status; } public ErrorResponse getErrorResponse() { return errorResponse; } public HttpHeaders getHeaders() { return headers; } public HttpStatus getStatus() { return status; } }