package org.apache.struts.util;

import org.apache.struts.action.ActionError;

public class ModuleException extends Exception {
  protected String property = null;
  
  protected ActionError error = null;
  
  public ModuleException(String key) {
    super(key);
    this.error = new ActionError(key);
  }
  
  public ModuleException(String key, Object value) {
    super(key);
    this.error = new ActionError(key, value);
  }
  
  public ModuleException(String key, Object value0, Object value1) {
    super(key);
    this.error = new ActionError(key, value0, value1);
  }
  
  public ModuleException(String key, Object value0, Object value1, Object value2) {
    super(key);
    this.error = new ActionError(key, value0, value1, value2);
  }
  
  public ModuleException(String key, Object value0, Object value1, Object value2, Object value3) {
    super(key);
    this.error = new ActionError(key, value0, value1, value2, value3);
  }
  
  public ModuleException(String key, Object[] values) {
    this.error = new ActionError(key, values);
  }
  
  public String getProperty() {
    return (this.property != null) ? this.property : this.error.getKey();
  }
  
  public void setProperty(String property) {
    this.property = property;
  }
  
  public ActionError getError() {
    return this.error;
  }
}
