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:
Patrik Oldsberg
2022-02-14 13:32:42 +01:00
parent c939e23269
commit f0e2f7a56a
4 changed files with 10 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/integration-react': patch
---
Updated the `ScmAuth` error message for missing provider configurations to link to `ScmAuthApi` setup documentation.
+1
View File
@@ -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`,
);
}