Skip to main content
Participating Frequently
March 9, 2025
Question

how do I thow error from catalog:withWriteAccessDo() ?

  • March 9, 2025
  • 1 reply
  • 111 views

How can I thow error from catalog:withWriteAccessDo() ?

 

I was to throw an error when calling function inside catalog:withWriteAccessDo() and handle it outside of catalog:withWriteAccessDo().

 

How to do it?

1 reply

johnrellis
Legend
March 10, 2025

Here's an example:

local success, err = LrTasks.pcall (function ()
    catalog:withWriteAccessDo ("Test", function ()
        error ("My error") end) end)

 

 Note that you must use LrTasks.pcall() rather than the Lua pcall() because of LR's tasking architecture.