package io.delphiplatform.api.exception;

import java.util.stream.Collectors;
import java.util.stream.Stream;

import io.delphiplatform.api.v3.constant.ApplicationConstants;

public class InvalidParameterException extends ServiceRuntimeException {

    public InvalidParameterException(String paramName, Stream<Object> possibleValues, String wrongValue) {
        super(String.format(ApplicationConstants.ERROR_MESSAGE, paramName, possibleValues.map(Object::toString)
            .collect(Collectors.joining(",")), wrongValue));
    }

    public InvalidParameterException(String errorMessage) {
        super(errorMessage);
    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }

}
