mirror of
https://github.com/lune-org/lune.git
synced 2025-04-04 10:30:54 +01:00
Handle decompress errors better
This commit is contained in:
parent
ba390399d4
commit
57323e55c0
1 changed files with 20 additions and 2 deletions
|
@ -191,7 +191,25 @@ for _, spec in OUTPUT_FILES do
|
|||
end
|
||||
|
||||
-- Check if the compressed contents can be decompressed using serde
|
||||
local decompressedContents = serde.decompress(spec.format, compressedContents)
|
||||
local decompressSuccess, decompressedContents =
|
||||
pcall(serde.decompress, spec.format, compressedContents)
|
||||
if not decompressSuccess then
|
||||
stdio.ewrite("\nCompressed contents could not be decompressed using serde!")
|
||||
stdio.ewrite("\n\nCompressed:\n")
|
||||
stdio.ewrite(stringAsHex(compressedContents))
|
||||
stdio.ewrite("\n\n")
|
||||
stdio.ewrite("Error:\n")
|
||||
stdio.ewrite(tostring(decompressedContents))
|
||||
stdio.ewrite("\n\n")
|
||||
local confirm = stdio.prompt("confirm", "Do you want to continue?")
|
||||
if confirm == true then
|
||||
print("Ignoring decompression error!")
|
||||
else
|
||||
stdio.ewrite("\n\nAborting...\n")
|
||||
process.exit(1)
|
||||
return
|
||||
end
|
||||
end
|
||||
if decompressedContents ~= INPUT_FILE_CONTENTS then
|
||||
stdio.ewrite("\nCompressed contents were not decompressable properly using serde!")
|
||||
stdio.ewrite("\n\nOriginal:\n")
|
||||
|
@ -201,7 +219,7 @@ for _, spec in OUTPUT_FILES do
|
|||
stdio.ewrite("\n\n")
|
||||
local confirm = stdio.prompt("confirm", "Do you want to continue?")
|
||||
if confirm == true then
|
||||
print("Ignoring decompression error!")
|
||||
print("Ignoring decompression mismatch!")
|
||||
else
|
||||
stdio.ewrite("\n\nAborting...\n")
|
||||
process.exit(1)
|
||||
|
|
Loading…
Add table
Reference in a new issue