Fix potential NPE in AppsmithException. Also removed unused methods.
This commit is contained in:
parent
1a19a9b698
commit
a96b1005ff
|
|
@ -7,12 +7,8 @@ import lombok.Setter;
|
||||||
@Setter
|
@Setter
|
||||||
public class AppsmithException extends Exception {
|
public class AppsmithException extends Exception {
|
||||||
|
|
||||||
private AppsmithError error;
|
private final AppsmithError error;
|
||||||
private Object[] args;
|
private final transient Object[] args;
|
||||||
|
|
||||||
public AppsmithException(String msg) {
|
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppsmithException(AppsmithError error, Object... args) {
|
public AppsmithException(AppsmithError error, Object... args) {
|
||||||
super(error.getMessage(args));
|
super(error.getMessage(args));
|
||||||
|
|
@ -21,15 +17,16 @@ public class AppsmithException extends Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getHttpStatus() {
|
public Integer getHttpStatus() {
|
||||||
return this.error.getHttpErrorCode();
|
return this.error == null ? 500 : this.error.getHttpErrorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage(Object... args) {
|
@Override
|
||||||
return this.error.getMessage(this.args);
|
public String getMessage() {
|
||||||
|
return this.error == null ? super.getMessage() : this.error.getMessage(this.args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAppErrorCode() {
|
public Integer getAppErrorCode() {
|
||||||
return this.error.getAppErrorCode();
|
return this.error == null ? -1 : this.error.getAppErrorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user