removed unnecessary try catch and minor ui cleanup

Signed-off-by: npiyush97 <npiyush35@gmail.com>
This commit is contained in:
npiyush97
2024-02-23 11:06:18 +05:30
parent 2b632c4433
commit af927f1d47
2 changed files with 21 additions and 25 deletions
@@ -177,32 +177,29 @@ the component will become available.\n\nFor more information, read an \
}): Promise<{ link: string; location: string }> {
const { repositoryUrl, fileContent, title, body } = options;
const parseData = YAML.parse(fileContent);
try {
const validationResponse = await this.catalogApi.validateEntity(
parseData,
`url:${repositoryUrl}`,
);
if (!validationResponse.valid) {
throw new Error(validationResponse.errors[0].message);
}
const ghConfig = getGithubIntegrationConfig(
this.scmIntegrationsApi,
repositoryUrl,
);
if (ghConfig) {
return await this.submitGitHubPrToRepo({
...ghConfig,
repositoryUrl,
fileContent,
title,
body,
});
}
throw new Error('unimplemented!');
} catch (err) {
throw err;
const validationResponse = await this.catalogApi.validateEntity(
parseData,
`url:${repositoryUrl}`,
);
if (!validationResponse.valid) {
throw new Error(validationResponse.errors[0].message);
}
const ghConfig = getGithubIntegrationConfig(
this.scmIntegrationsApi,
repositoryUrl,
);
if (ghConfig) {
return await this.submitGitHubPrToRepo({
...ghConfig,
repositoryUrl,
fileContent,
title,
body,
});
}
throw new Error('unimplemented!');
}
// TODO: this could be part of the catalog api
@@ -76,7 +76,6 @@ export const StepFinishImportLocation = ({ prepareResult, onReset }: Props) => {
<Grid container spacing={0}>
<BackButton onClick={onReset}>Register another</BackButton>
</Grid>
;
</>
);
}