fix: use NotFoundError for missing team in org
Per [PR comment][1], better to use the provided error type that more closely matches the error encountered. [1]: https://github.com/backstage/backstage/pull/16059#discussion_r1103873709 Signed-off-by: Christopher Kruse <ckruse@flexport.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Config } from '@backstage/config';
|
||||
import { assertError, InputError } from '@backstage/errors';
|
||||
import { assertError, InputError, NotFoundError } from '@backstage/errors';
|
||||
import {
|
||||
DefaultGithubCredentialsProvider,
|
||||
GithubCredentialsProvider,
|
||||
@@ -370,7 +370,7 @@ async function validateAccessTeam(client: Octokit, access: string) {
|
||||
if (e.response.data.message === 'Not Found') {
|
||||
const message = `Received 'Not Found' from the API; one of org:
|
||||
${org} or team: ${team_slug} was not found within GitHub.`;
|
||||
throw new Error(message, { cause: e });
|
||||
throw new NotFoundError(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user