/**
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
package org.openmrs.module.webservices.rest.web.response;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * This is a marker class for all response expections. Controllers should throw these if an error
 * has occurred or a status needs to be shown to a user
 */
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR, reason = "Unable to convert object into response content")
public class ConversionException extends ResponseException {
	
	private static final long serialVersionUID = 1L;
	
	public ConversionException() {
		super();
	}
	
	/**
	 * @param message
	 * @param cause
	 */
	public ConversionException(String message, Throwable cause) {
		super(message, cause);
	}
	
	/**
	 * @param message
	 */
	public ConversionException(String message) {
		super(message);
	}
	
	/**
	 * @param cause
	 */
	public ConversionException(Throwable cause) {
		super(cause);
	}
	
}

/**
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
package org.openmrs.module.webservices.rest.web.response;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * This is a marker class for all response exceptions. Controllers should throw these if an error
 * has occurred or a status needs to be shown to a user
 */
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Unable to convert object into response content")
public class ConversionException extends ResponseException {
	
	private static final long serialVersionUID = 1L;
	
	public ConversionException() {
		super();
	}
	
	/**
	 * @param message
	 * @param cause
	 */
	public ConversionException(String message, Throwable cause) {
		super(message, cause);
	}
	
	/**
	 * @param message
	 */
	public ConversionException(String message) {
		super(message);
	}
	
	/**
	 * @param cause
	 */
	public ConversionException(Throwable cause) {
		super(cause);
	}
	
}

Handle internal errors gracefully, make them self-explanatory