/**
 * 
 */
package com.tvd12.ezyfox.core.exception;

import lombok.Getter;

/**
 * Throw this exception when user has a bad request or user didn't pass validation
 * 
 * @author tavandung12
 *
 */
public class EzyBadRequestException extends RuntimeException {
	private static final long serialVersionUID = 2045148125148130757L;
	
	@Getter
    private int code;
    @Getter
    private String reason = "unknown";
    @Getter
    private boolean sendToClient = true;
    
    public EzyBadRequestException() {
        super();
        this.sendToClient = false;
    }
    
    public EzyBadRequestException(String msg) {
        this(msg, 0, false);
    }
    
    public EzyBadRequestException(String msg, Throwable e) {
        this(msg, 0, false, e);
    }
    
    public EzyBadRequestException(int code) {
        this(code, true);
    }
    
    public EzyBadRequestException(String msg, int code) {
        this(msg, code, true);
    }
    
    public EzyBadRequestException(String msg, int code, Throwable e) {
        this(msg, code, true, e);
    }
    
    public EzyBadRequestException(int code, boolean sendToClient) {
        super();
        this.code = code;
        this.sendToClient = sendToClient;
    }
    
    public EzyBadRequestException(int code, boolean sendToClient, Throwable e) {
        super(e);
        this.code = code;
        this.sendToClient = sendToClient;
    }
    
    public EzyBadRequestException(String msg, int code, boolean sendToClient) {
        super(msg);
        this.code = code;
        this.reason = msg;
        this.sendToClient = sendToClient;
    }
    
    public EzyBadRequestException(String msg, int code, boolean sendToClient, Throwable e) {
        super(msg, e);
        this.code = code;
        this.reason = msg;
        this.sendToClient = sendToClient;
    }

}

@@ -978,72 +978,272 @@
 ion(
-String msg, int code, Throwable e) %7B%0A        this(msg, code, tru
+int code, String msg) %7B%0A    %09%09this(msg, code);%0A    %7D%0A    %0A    public EzyBadRequestException(String msg, int code, Throwable e) %7B%0A        this(msg, code, true, e);%0A    %7D%0A    %0A    public EzyBadRequestException(int code, String msg, Throwable e) %7B%0A    %09%09this(msg, cod
 e, e
@@ -1590,32 +1590,160 @@
 ent;%0A    %7D%0A    %0A
+    public EzyBadRequestException(int code, String msg, boolean sendToClient) %7B%0A    %09%09this(msg, code, sendToClient);%0A    %7D%0A    %0A
     public EzyBa
@@ -1924,32 +1924,176 @@
 ent;%0A    %7D%0A    %0A
+    public EzyBadRequestException(int code, String msg, boolean sendToClient, Throwable e) %7B%0A    %09%09this(msg, code, sendToClient, e);%0A    %7D%0A    %0A
     public EzyBa

update BadRequestException