diff --git a/scripts/download/default_sources.lua b/scripts/download/default_sources.lua index 0b574ed8..21e7da36 100644 --- a/scripts/download/default_sources.lua +++ b/scripts/download/default_sources.lua @@ -24,10 +24,8 @@ return { days = { true, true, true, true, true, true, true }, func = [[ assert(curl.get(puzzle.url, puzzle.filename, puzzle.curlopts)) - local success, p = pcall(puz.Puzzle, puzzle.filename, import.Newsday) - if success then - p:Save(puzzle.filename) -- Save this as a puz - end + local p = puz.Puzzle(puzzle.filename, import.Newsday) + p:Save(puzzle.filename) -- Save this as a puz ]] }, @@ -133,11 +131,11 @@ return { -- Get the crossword data local data = page2:match("rawc%s*=%s*'([^']+)'") if data then - -- Using the data _as_ the filename is kind of a hack, but it works - local success, p = pcall(puz.Puzzle, data, import.amuselabsBase64) - if success then - p:Save(puzzle.filename) -- Save this as a jpz - end + -- Using the data _as_ the input filename is kind of a hack, but it works + local p = puz.Puzzle(data, import.amuselabsBase64) + p:Save(puzzle.filename) + else + return "Unable to find puzzle data" end ]] }, @@ -154,10 +152,10 @@ return { -- Get the crossword data local data = page:match("rawc%s*=%s*'([^']+)'") if data then - local success, p = pcall(puz.Puzzle, data, import.amuselabsBase64) - if success then - p:Save(puzzle.filename) - end + local p = puz.Puzzle(data, import.amuselabsBase64) + p:Save(puzzle.filename) + else + return "Unable to find puzzle data" end ]] }, @@ -190,10 +188,10 @@ return { -- Get the crossword data local data = page2:match("rawc%s*=%s*'([^']+)'") if data then - local success, p = pcall(puz.Puzzle, data, import.amuselabsBase64) - if success then - p:Save(puzzle.filename) - end + local p = puz.Puzzle(data, import.amuselabsBase64) + p:Save(puzzle.filename) + else + return "Unable to find puzzle data" end ]] }, diff --git a/scripts/download/download_task.lua b/scripts/download/download_task.lua index fb1817a3..b6639686 100644 --- a/scripts/download/download_task.lua +++ b/scripts/download/download_task.lua @@ -254,7 +254,7 @@ local function download(puzzle) -- which case we should differentiate between user-called asserts -- (using myassert and ASSERT_ERROR), or an actual programming error. ASSERT_ERROR = false - local success, result, err = xpcall(function() return func(puzzle, curl.get, myassert, mypuz) end, debug.traceback) + local success, result, err = pcall(function() return func(puzzle, curl.get, myassert, mypuz) end) -- gc puzles cleanup_puzzles() -- Figure out what to return @@ -352,4 +352,4 @@ return { func, [mgr.CLEAR]=on_clear, [mgr.LOGIN]=on_relogin -} \ No newline at end of file +}