mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Refactor showing error notification
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
2bc7757907
commit
8d52c43a71
@ -63,7 +63,9 @@ export async function createTempFilesAndValidate({
|
|||||||
const manifest = await validatePackage(tempFile);
|
const manifest = await validatePackage(tempFile);
|
||||||
|
|
||||||
if (!isCompatibleExtension(manifest)){
|
if (!isCompatibleExtension(manifest)){
|
||||||
throw new Error("Incompatible extension");
|
displayError(fileName, { message: "Incompatible extension" });
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const id = path.join(
|
const id = path.join(
|
||||||
@ -80,6 +82,13 @@ export async function createTempFilesAndValidate({
|
|||||||
id,
|
id,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
displayError(fileName, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayError(fileName: string, error: any) {
|
||||||
const message = getMessageFromError(error);
|
const message = getMessageFromError(error);
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
@ -98,9 +107,6 @@ export async function createTempFilesAndValidate({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getExtensionPackageTemp(fileName = "") {
|
function getExtensionPackageTemp(fileName = "") {
|
||||||
return path.join(os.tmpdir(), "lens-extensions", fileName);
|
return path.join(os.tmpdir(), "lens-extensions", fileName);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user