fix: fix issue where wrapApiConfigurationError would fail to regex match a string due to boundary constraints on the regex
This commit is contained in:
parent
2be6da694a
commit
73c938dbc0
6 changed files with 10 additions and 6 deletions
|
|
@ -122,6 +122,8 @@ test("wrapApiConfigurationError correctly wraps specific configuration errors",
|
|||
res = api.wrapApiConfigurationError(httpError);
|
||||
t.is(res, httpError);
|
||||
|
||||
// For other HTTP errors, we wrap them as Configuration errors if they contain
|
||||
// specific error messages.
|
||||
const httpNotFoundError = new util.HTTPError("commit not found", 404);
|
||||
res = api.wrapApiConfigurationError(httpNotFoundError);
|
||||
t.deepEqual(res, new util.ConfigurationError("commit not found"));
|
||||
|
|
@ -134,7 +136,7 @@ test("wrapApiConfigurationError correctly wraps specific configuration errors",
|
|||
t.deepEqual(
|
||||
res,
|
||||
new util.ConfigurationError(
|
||||
"ref 'refs/heads/jitsi' not found in this repository",
|
||||
"ref 'refs/heads/jitsi' not found in this repository - https://docs.github.com/rest",
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ export function wrapApiConfigurationError(e: unknown) {
|
|||
if (
|
||||
e.message.includes("API rate limit exceeded for installation") ||
|
||||
e.message.includes("commit not found") ||
|
||||
/^ref .* not found in this repository$/.test(e.message)
|
||||
/ref .* not found in this repository/.test(e.message)
|
||||
) {
|
||||
return new ConfigurationError(e.message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue