package com.oguerreiro.resilient.error;

public class OutputExpressionEvaluationRuntimeException extends ResilientRuntimeException {
  private static final String CODE = "E009";

  public OutputExpressionEvaluationRuntimeException(String outputVariableCode, String organizationCode, String period,
      String periodVersion, String expression, ExpressionEvaluationException cause) {
    super("An error occurred calculating the output: Variable Code=" + outputVariableCode + ", Organization Code="
        + organizationCode + ", Period=" + period + ", Period Version=" + periodVersion + ", Expression=" + expression
        + ". With the error: " + cause.getMessage(), cause);

    addMessageArg(outputVariableCode);
    addMessageArg(organizationCode);
    addMessageArg(period);
    addMessageArg(periodVersion);
    addMessageArg(expression);
    addMessageArg(cause.getMessage());
  }

  @Override
  public String getMessageCode() {
    return CODE;
  }

}
