more strict error type checking in most packages and backend plugins

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-10-08 17:41:29 +02:00
parent 9d18bc8ba4
commit 36e67d2f24
68 changed files with 248 additions and 104 deletions
+1
View File
@@ -25,6 +25,7 @@
},
"devDependencies": {
"@backstage/cli-common": "^0.1.1",
"@backstage/errors": "^0.1.2",
"@types/fs-extra": "^9.0.1",
"@types/node": "^14.14.32",
"chalk": "^4.0.0",
+5 -2
View File
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import { assertError } from '@backstage/errors';
import {
spawn,
execFile as execFileCb,
@@ -66,11 +67,12 @@ export async function runPlain(cmd: string[], options?: SpawnOptions) {
});
return stdout.trim();
} catch (error) {
assertError(error);
if (error.stdout) {
process.stdout.write(error.stdout);
process.stdout.write(error.stdout as Buffer);
}
if (error.stderr) {
process.stderr.write(error.stderr);
process.stderr.write(error.stderr as Buffer);
}
throw error;
}
@@ -147,6 +149,7 @@ export async function waitForPageWithText(
);
break;
} catch (error) {
assertError(error);
if (error.message.match(EXPECTED_LOAD_ERRORS)) {
loadAttempts++;
if (loadAttempts >= maxLoadAttempts) {