• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

scripts with syntax error do not create an error message anymore

Community Beginner ,
Jul 07, 2024 Jul 07, 2024

Copy link to clipboard

Copied

I have a couple of lua scripts (in the scripts folder) making my daily life with Lightroom Classic easier.

This works great, even in the current version 13.4

Today I started to write a new script and realized, that if there is a syntax error, the script simply does nothing.

In previous versions of Lightroom I got a message box telling me what's wrong, but with 13.4 nothing happens.

Assume the following script:

note the syntax error in the first line

lo cal LrDialogs = import 'LrDialogs'
local LrApplication = import 'LrApplication'
local catalog = LrApplication.activeCatalog()
local LrTasks = import 'LrTasks'

LrTasks.startAsyncTask( function()

    local targetPhoto = catalog:getTargetPhoto()
    local photoId = targetPhoto.localIdentifier
    LrDialogs.message("PhotoIDs", "photoId: " .. tostring(photoId))
end)	

This buggy script does not produce a syntax error.

 

Can anyone confirm this?

 

Thanks

Jacques

TOPICS
SDK , Windows

Views

50

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 11, 2024 Jul 11, 2024

Copy link to clipboard

Copied

LATEST

LR usually silently discards syntax errors. I tested your script with these versions on Mac OS 14.4 -- 13.4, 13.0, 12.0, 11.0 -- and none produced an error when invoked from the Scripts menu.

 

And LR still silently discards runtime errors in many contexts. For example, this version will alert the user to an internal error:

local cal LrDialogs = import 'LrDialogs'
local LrApplication = import 'LrApplication'
local catalog = LrApplication.activeCatalog()
local LrTasks = import 'LrTasks'

--error ("Darn it!")
LrTasks.startAsyncTask( function()
    error ("Darn it!")

    local targetPhoto = catalog:getTargetPhoto()
    local photoId = targetPhoto.localIdentifier
    LrDialogs.message("PhotoIDs", "photoId: " .. tostring(photoId))
end)    

 

but uncommenting the first error() won't alert the user.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines