Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added some error handling (try-catch blocks) in js files #4601

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/quill/scripts/babel-svg-inline-import.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ module.exports = ({ types: t }) => {
const id = specifier.local.name;
const reference = state && state.file && state.file.opts.filename;
const absolutePath = resolve(dirname(reference), givenPath);
const content = optimize(
fs.readFileSync(absolutePath).toString(),
{ plugins: [] },
).data;
const content = fs.readFileSync(absolutePath).toString();
let optimizedContent;
try {
optimizedContent = optimize(content, { plugins: [] }).data;
} catch (error) {
console.error(`Error optimizing SVG: ${absolutePath}`, error);
return;
}

const variableValue = t.stringLiteral(content);
const variable = t.variableDeclarator(
Expand Down
15 changes: 14 additions & 1 deletion scripts/changelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ const changeLogFilePath = join(
changelogFilename
);

const currentChangeLog = await readFile(changeLogFilePath, "utf-8");
(async () => {
try {
const currentChangeLog = await readFile(changeLogFilePath, "utf-8");

} catch (error) {
console.error("Error occurred:", error);
process.exit(1);
}

const { stdout } =
await $`gh release list --exclude-drafts --json=tagName,publishedAt,name,isLatest`;
Expand Down Expand Up @@ -66,3 +73,9 @@ await $`git add ${changelogFilename}`;
const message = `Update ${changelogFilename}: ${release.tagName}`;
await $`git commit -m ${message}`;
await $`git push origin main`;

} catch (error) {
console.error("An error occurred:", error);
process.exit(1);
}
})();
12 changes: 10 additions & 2 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ if (!process.env.CI) {
exec('echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc');

async function main() {
const configGit = (await import("./utils/configGit.mjs")).default;
await configGit();
try {
const configGit = (await import("./utils/configGit.mjs")).default;
await configGit();



} catch (error) {
console.error("An error occurred:", error);
exitWithError("Exiting due to an error.");
}
}
/*
* Check that the git working directory is clean
*/
Expand Down