org.seedstack.i18n.rest.exception.mapper.InternalExceptionMapper Maven / Gradle / Ivy
/**
* Copyright (c) 2013-2015 by The SeedStack authors. All rights reserved.
*
* This file is part of SeedStack, An enterprise-oriented full development stack.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.i18n.rest.exception.mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
/**
* @author [email protected]
* Date: 30/04/2014
*/
@Provider
public class InternalExceptionMapper implements ExceptionMapper {
private static final Logger LOGGER = LoggerFactory.getLogger(InternalExceptionMapper.class);
@Override
public Response toResponse(Exception exception) {
LOGGER.error(exception.getMessage(), exception);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity("Internal error occurs.")
.type(MediaType.TEXT_PLAIN_TYPE).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy