🎨 Improve error output
This commit is contained in:
parent
6f6f168192
commit
662c2d5f43
2 changed files with 17 additions and 9 deletions
|
@ -38,18 +38,26 @@ export default async function getPatch(product: Product, from: number, to: numbe
|
||||||
|
|
||||||
//Extract newly added files
|
//Extract newly added files
|
||||||
fileEntries.filter((file) => file.diffType === SsnDiffType.NewFile).forEach(async (file) => {
|
fileEntries.filter((file) => file.diffType === SsnDiffType.NewFile).forEach(async (file) => {
|
||||||
const fileStream = await getFileFromDisks(diskFilenames, { diskStart: file.diskNumberStart, offset: file.offset, storedSize: file.compressedSize });
|
try {
|
||||||
const fileContents = extractFileStream(file, fileStream);
|
const fileStream = await getFileFromDisks(diskFilenames, { diskStart: file.diskNumberStart, offset: file.offset, storedSize: file.compressedSize });
|
||||||
console.debug(await streamToArrayBuffer(fileContents));
|
const fileContents = extractFileStream(file, fileStream);
|
||||||
//TODO: need to write to disk
|
console.debug(await streamToArrayBuffer(fileContents));
|
||||||
|
//TODO: need to write to disk
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Could not extract file "${file.name}"`, error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Extract changed files
|
//Extract changed files
|
||||||
fileEntries.filter((file) => file.diffType === SsnDiffType.Changed).forEach(async (file) => {
|
fileEntries.filter((file) => file.diffType === SsnDiffType.Changed).forEach(async (file) => {
|
||||||
const fileStream = await getFileFromDisks(diskFilenames, { diskStart: file.diskNumberStart, offset: file.offset, storedSize: file.compressedSize });
|
try {
|
||||||
const fileContents = extractFileStream(file, fileStream);
|
const fileStream = await getFileFromDisks(diskFilenames, { diskStart: file.diskNumberStart, offset: file.offset, storedSize: file.compressedSize });
|
||||||
console.debug(await streamToArrayBuffer(fileContents));
|
const fileContents = extractFileStream(file, fileStream);
|
||||||
//TODO: need to apply diffing, then write to disk
|
console.debug(await streamToArrayBuffer(fileContents));
|
||||||
|
//TODO: need to apply diffing, then write to disk
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Could not extract file "${file.name}"`, error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Need to delete deleted files
|
//Need to delete deleted files
|
||||||
|
|
|
@ -12,7 +12,7 @@ interface IGetFileFromDisksOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStream(disks: string[], index: number, offset: number, length: number = Infinity) {
|
function getStream(disks: string[], index: number, offset: number, length: number = Infinity) {
|
||||||
return fs.createReadStream(disks[index], { start: offset }); //, end: offset + length - 1 });
|
return fs.createReadStream(disks[index], { start: offset });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Takes a list of ReadableStreams (the disks), as well as the offset and length, and returns a stream for just one file. */
|
/** Takes a list of ReadableStreams (the disks), as well as the offset and length, and returns a stream for just one file. */
|
||||||
|
|
Loading…
Reference in a new issue