package org.cobbzilla.wizard.api;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import org.cobbzilla.util.http.HttpRequestBean;
import org.cobbzilla.wizard.util.RestResponse;

import static org.cobbzilla.util.json.JsonUtil.json;

@AllArgsConstructor @ToString
public class ApiException extends RuntimeException {

    @Getter private HttpRequestBean request;
    @Getter private RestResponse response;

    public ApiException (RestResponse response) {
        super(response.status+": "+response.json);
        this.response = response;
    }

    @Override public String getMessage () { return response.json; }

}

@@ -208,62 +208,8 @@
 e;%0A%0A
-import static org.cobbzilla.util.json.JsonUtil.json;%0A%0A
 @All
@@ -353,16 +353,22 @@
 private 
+final 
 RestResp
@@ -575,16 +575,41 @@
 %7B return
+ response.status + %22: %22 +
  respons

add status code to ApiException message