Skip to content
Draft
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
10 changes: 9 additions & 1 deletion lib/commands/serve/streempublic.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const getFile = (url, dest) => new Promise((resolve, reject) => {
file.close(() => resolve());
});
}).on('error', function (err) {
process.stdout.write('\n');
error('Main Frame URL could not be found. Please make sure .development.env file has the correct MAINFRAME_URL settings.');
error(err);
fs.unlink(dest);
Expand All @@ -66,7 +67,14 @@ exports.prapereDevPub = async function (api, pubzipurl) {
const sfConfig = require(api.resolve('sf.config.js'));

const localzipfile = path.resolve(__dirname, pubzipurl);
await getFile(sfConfig.mainFrameUrl + '/' + pubzipurl, localzipfile);
try {
await getFile(sfConfig.mainFrameUrl + '/' + pubzipurl, localzipfile);
} catch (err) {
process.stdout.write('\n');
error('Error downloading MainFrame Xpublic zip file:');
error(err);
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The try-catch block catches errors but doesn't prevent the function from continuing execution. After an error occurs during file download, the code proceeds to lines 78-82 where it attempts to unzip a file that may not exist (localzipfile), which will cause additional errors. The catch block should either re-throw the error or return early to prevent further execution.

Suggested change
error(err);
error(err);
throw err;

Copilot uses AI. Check for mistakes.
}

const zip = new zipper(localzipfile);
const destiny = path.resolve(__dirname + '/devpub')
zip.extractAllTo(destiny, true);
Expand Down
Loading