integration-react: link to scm auth setup docs if provider config is missing
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/integration-react': patch
|
||||
---
|
||||
|
||||
Updated the `ScmAuth` error message for missing provider configurations to link to `ScmAuthApi` setup documentation.
|
||||
@@ -5,6 +5,7 @@ const React = require('react');
|
||||
const redirects = {
|
||||
'bind-routes':
|
||||
'/docs/plugins/composability#binding-external-routes-in-the-app',
|
||||
'scm-auth': '/docs/auth/#custom-scmauthapi-implementation',
|
||||
};
|
||||
const fallback = '/docs';
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ describe('ScmAuth', () => {
|
||||
await expect(
|
||||
emptyMux.getCredentials({ url: 'http://example.com' }),
|
||||
).rejects.toThrow(
|
||||
"No authentication provider available for access to 'http://example.com'",
|
||||
"No auth provider available for 'http://example.com', see https://backstage.io/link?scm-auth",
|
||||
);
|
||||
|
||||
const scmAuth = ScmAuth.merge(
|
||||
@@ -256,12 +256,12 @@ describe('ScmAuth', () => {
|
||||
await expect(
|
||||
scmAuth.getCredentials({ url: 'http://not.example.com' }),
|
||||
).rejects.toThrow(
|
||||
"No authentication provider available for access to 'http://not.example.com'",
|
||||
"No auth provider available for 'http://not.example.com', see https://backstage.io/link?scm-auth",
|
||||
);
|
||||
await expect(
|
||||
scmAuth.getCredentials({ url: 'http://example.com:8080' }),
|
||||
).rejects.toThrow(
|
||||
"No authentication provider available for access to 'http://example.com:8080'",
|
||||
"No auth provider available for 'http://example.com:8080', see https://backstage.io/link?scm-auth",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ class ScmAuthMux implements ScmAuthApi {
|
||||
const provider = this.#providers.find(p => p.isUrlSupported(url));
|
||||
if (!provider) {
|
||||
throw new Error(
|
||||
`No authentication provider available for access to '${options.url}'`,
|
||||
`No auth provider available for '${options.url}', see https://backstage.io/link?scm-auth`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user