package com.atlassian.stash.internal.rest.exception;

import com.atlassian.bitbucket.rest.util.RestUtils;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;

class WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> {

    @Override
    public Response toResponse(WebApplicationException e) {
        return Response.fromResponse(e.getResponse())
                .type(RestUtils.APPLICATION_JSON_UTF8)
                .build();
    }
}
