scaffolder-backend: clarify type detection error message

This commit is contained in:
Patrik Oldsberg
2020-12-16 22:27:11 +01:00
parent eec95ab02b
commit aed8f7f12f
3 changed files with 27 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Clearer error message when preparer or publisher type can't be determined.
@@ -50,7 +50,17 @@ export class Preparers implements PreparerBuilder {
if (detected) {
return detected;
}
throw new Error(`No preparer integration found for url "${location}"`);
if (type) {
throw new Error(
`No preparer configuration available for type '${type}' with url "${location}". ` +
"Make sure you've added appropriate configuration in the 'scaffolder' configuration section",
);
} else {
throw new Error(
`Failed to detect preparer type. Unable to determine integration type for location "${location}". ` +
"Please add appropriate configuration to the 'integrations' configuration section",
);
}
}
throw new Error(`No preparer registered for type: "${protocol}"`);
}
@@ -51,7 +51,17 @@ export class Publishers implements PublisherBuilder {
if (detected) {
return detected;
}
throw new Error(`No preparer integration found for url "${location}"`);
if (type) {
throw new Error(
`No publisher configuration available for type '${type}' with url "${location}". ` +
"Make sure you've added appropriate configuration in the 'scaffolder' configuration section",
);
} else {
throw new Error(
`Failed to detect publisher type. Unable to determine integration type for location "${location}". ` +
"Please add appropriate configuration to the 'integrations' configuration section",
);
}
}
throw new Error(`No publisher registered for type: "${protocol}"`);
}