package com.atlassian.stash.internal.johnson.handler.exception;

import com.atlassian.stash.internal.johnson.handler.EventDetails;

import javax.annotation.Nonnull;

/**
 * @since 2.8.2
 */
public class SimpleExceptionFailureHandler implements ExceptionFailureHandler {

    private final String eventType;

    protected SimpleExceptionFailureHandler(String eventType) {
        this.eventType = eventType;
    }

    @Override
    public EventDetails handle(@Nonnull Throwable t) {
        return new EventDetails(eventType, t.getLocalizedMessage(), t);
    }
}
