-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleans and Rebase Error Message Factory PR (#16202)
* Cleaned error messages factory PR * Bumped MySQL and Postgres version * Fixed messages and typos in test * Fixes the changelog conflict with per-stream state * Added note for flaky test * Bumps mysql version to match changelog * Added exception objects to all LOGGER.error for more visibility * auto-bump connector version [ci skip] Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
- Loading branch information
1 parent
dcfcb75
commit 50a8d03
Showing
39 changed files
with
988 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
airbyte-db/db-lib/src/main/java/io/airbyte/db/exception/ConnectionErrorException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.db.exception; | ||
|
||
public class ConnectionErrorException extends RuntimeException { | ||
|
||
private String stateCode; | ||
private int errorCode; | ||
private String exceptionMessage; | ||
|
||
public ConnectionErrorException(final String exceptionMessage) { | ||
super(exceptionMessage); | ||
} | ||
|
||
public ConnectionErrorException(final String stateCode, final Throwable exception) { | ||
super(exception); | ||
this.stateCode = stateCode; | ||
this.exceptionMessage = exception.getMessage(); | ||
} | ||
|
||
public ConnectionErrorException(final String stateCode, | ||
final String exceptionMessage, | ||
final Throwable exception) { | ||
super(exception); | ||
this.stateCode = stateCode; | ||
this.exceptionMessage = exceptionMessage; | ||
} | ||
|
||
public ConnectionErrorException(final String stateCode, | ||
final int errorCode, | ||
final String exceptionMessage, | ||
final Throwable exception) { | ||
super(exception); | ||
this.stateCode = stateCode; | ||
this.errorCode = errorCode; | ||
this.exceptionMessage = exceptionMessage; | ||
} | ||
|
||
public String getStateCode() { | ||
return this.stateCode; | ||
} | ||
|
||
public int getErrorCode() { | ||
return errorCode; | ||
} | ||
|
||
public String getExceptionMessage() { | ||
return exceptionMessage; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...es/base-java/src/main/java/io/airbyte/integrations/base/errors/messages/ErrorMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.base.errors.messages; | ||
|
||
import java.util.Objects; | ||
|
||
public class ErrorMessage { | ||
|
||
// TODO: this could be built using a Builder design pattern instead of passing in 0 to indicate no | ||
// errorCode exists | ||
public static String getErrorMessage(final String stateCode, final int errorCode, final String message, final Exception exception) { | ||
if (Objects.isNull(message)) { | ||
return configMessage(stateCode, 0, exception.getMessage()); | ||
} else { | ||
return configMessage(stateCode, errorCode, message); | ||
} | ||
} | ||
|
||
private static String configMessage(final String stateCode, final int errorCode, final String message) { | ||
final String stateCodePart = Objects.isNull(stateCode) ? "" : String.format("State code: %s; ", stateCode); | ||
final String errorCodePart = errorCode == 0 ? "" : String.format("Error code: %s; ", errorCode); | ||
return String.format("%s%sMessage: %s", stateCodePart, errorCodePart, message); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
airbyte-integrations/bases/base-normalization/unit_tests/private_key_path.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AIRBYTE_PRIVATE_KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.