Modified error message and code for authentication failure (#5810)

This commit is contained in:
Nidhi 2021-07-14 11:36:25 +05:30 committed by GitHub
parent 4f42c29f95
commit 597033e623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -25,6 +25,8 @@ public enum AppsmithPluginError {
AppsmithErrorAction.LOG_EXTERNALLY, "Datasource configuration is invalid"),
PLUGIN_DATASOURCE_TIMEOUT_ERROR(504, 5008, "{0}", AppsmithErrorAction.DEFAULT, "Timed out when connecting to " +
"datasource"),
PLUGIN_AUTHENTICATION_ERROR(401, 4000, "Invalid authentication credentials. Please check datasource configuration.",
AppsmithErrorAction.DEFAULT, "Datasource authentication error"),
;
private final Integer httpErrorCode;

View File

@ -85,9 +85,7 @@ public class OAuth2 extends AuthenticationDTO {
@Override
public Mono<Boolean> hasExpired() {
if (this.authenticationResponse == null) {
return Mono.error(new AppsmithPluginException(
AppsmithPluginError.PLUGIN_ERROR,
"Expected datasource to have valid authentication tokens at this point"));
return Mono.error(new AppsmithPluginException(AppsmithPluginError.PLUGIN_AUTHENTICATION_ERROR));
}
if (this.authenticationResponse.expiresAt == null) {