Add changeset

This commit is contained in:
Adam Harvey
2021-01-29 16:20:07 -05:00
parent cb61bc8cbb
commit 45de779d5f
2 changed files with 21 additions and 8 deletions
+16 -8
View File
@@ -119,14 +119,22 @@ export class TechDocsStorageApi implements TechDocsStorage {
`${url.endsWith('/') ? url : `${url}/`}index.html`,
);
if (request.status === 404) {
let errorMessage = 'Page not found. ';
// path is empty for the home page of an entity's docs site
if (!path) {
errorMessage +=
'This could be because there is no index.md file in the root of the docs directory of this repository.';
}
throw new Error(errorMessage);
let errorMessage = '';
switch (request.status) {
case 404:
errorMessage = 'Page not found. ';
// path is empty for the home page of an entity's docs site
if (!path) {
errorMessage +=
'This could be because there is no index.md file in the root of the docs directory of this repository.';
}
throw new Error(errorMessage);
case 500:
errorMessage = 'Could not generate documentation. ';
throw new Error(errorMessage);
default:
// Do nothing
break;
}
return request.text();