Java: Add toString method to ApiException (#12851)

Previously, only the class name appeared in stacktrace whereas now
relevant details are added. This applies to most Java-related
generators.
This commit is contained in:
Sascha Peilicke 2022-07-16 11:20:30 +02:00 committed by GitHub
parent cb462851b5
commit bf604a08ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 136 additions and 14 deletions

View File

@ -77,4 +77,13 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us
public String getResponseBody() { public String getResponseBody() {
return responseBody; return responseBody;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
", responseHeaders=" + responseHeaders +
", responseBody='" + responseBody + '\'' +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package {{apiPackage}};
*/ */
{{>generatedAnnotation}} {{>generatedAnnotation}}
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package {{apiPackage}};
*/ */
{{>generatedAnnotation}} {{>generatedAnnotation}}
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -12,7 +12,6 @@ import javax.annotation.Generated;
*/ */
{{>generatedAnnotation}} {{>generatedAnnotation}}
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -36,4 +35,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -27,4 +27,12 @@ public class ApiException extends Exception {
public void setMessage(String message) { public void setMessage(String message) {
this.message = message; this.message = message;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
", message=" + message +
'}';
}
} }

View File

@ -47,4 +47,12 @@ public class ApiException extends Exception {
public void setMessage(String message) { public void setMessage(String message) {
this.message = message; this.message = message;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
", message=" + message +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package {{apiPackage}};
*/ */
{{>generatedAnnotation}} {{>generatedAnnotation}}
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -88,4 +88,13 @@ public class ApiException extends Exception {
public String getResponseBody() { public String getResponseBody() {
return responseBody; return responseBody;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
", responseHeaders=" + responseHeaders +
", responseBody='" + responseBody + '\'' +
'}';
}
} }

View File

@ -88,4 +88,13 @@ public class ApiException extends Exception {
public String getResponseBody() { public String getResponseBody() {
return responseBody; return responseBody;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
", responseHeaders=" + responseHeaders +
", responseBody='" + responseBody + '\'' +
'}';
}
} }

View File

@ -88,4 +88,13 @@ public class ApiException extends Exception {
public String getResponseBody() { public String getResponseBody() {
return responseBody; return responseBody;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
", responseHeaders=" + responseHeaders +
", responseBody='" + responseBody + '\'' +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaMSF4JServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaMSF4JServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }

View File

@ -5,7 +5,6 @@ package org.openapitools.api;
*/ */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")
public class ApiException extends Exception { public class ApiException extends Exception {
/** The HTTP status code. */ /** The HTTP status code. */
private int code; private int code;
@ -29,4 +28,10 @@ public class ApiException extends Exception {
return code; return code;
} }
@Override
public String toString() {
return "ApiException{" +
"code=" + code +
'}';
}
} }