package com.atlassian.bitbucket.rest.exception;

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

/**
 * A aggregate class which when extended provides default exception mapping for the plugin.
 * <p>
 * All bundled plugins with REST resources should extend this class.
 */
public class UnhandledExceptionMapper implements ExceptionMapper<Exception> {

    private final UnhandledExceptionMapperHelper helper;

    public UnhandledExceptionMapper(UnhandledExceptionMapperHelper helper) {
        this.helper = helper;
    }

    @Override
    public Response toResponse(Exception exception) {
        return helper.map(exception);
    }
}
