package com.oguerreiro.resilient.error;

import java.util.ArrayList;
import java.util.List;

public abstract class ResilientException extends Exception {
	private List<Object> messageArgs;
	
	public ResilientException(String message) {
		super(message);
	}
	
	public abstract String getMessageCode();
	
	protected void addMessageArg(Object arg)  {
		if (this.messageArgs == null)
			this.messageArgs = new ArrayList<Object>();
		
		this.messageArgs.add(arg);
	}
	
	protected List<Object> args() {
		return this.messageArgs;
	}
	
	public Object[] getMessageArgs() {
		return this.messageArgs.toArray();
	}
}
