photools.com Community

IMatch Discussion Boards => IMatch Scripting and Apps => Topic started by: ubacher on April 07, 2019, 01:55:09 PM

Title: v1/files/move fails to throw error when file to be moved is locked
Post by: ubacher on April 07, 2019, 01:55:09 PM
I am moving files to a folder via script. Today one file was not moved. It happened to be still open in
ACR (Photoshop camera raw). The script did not throw an error!
Here is the code I use:
  async function moveFiles(files, folderName) {
            var ids = '';
            for (var mm = 0; mm < files.length; mm++) {
                ids = ids + files[mm].id + ','
            }
            try {
                await IMWS.post('v1/files/move', {
                    id: ids,
                    target: folderName,
                    replace: 'makeunique'
                })
                {
                    console.log('done, # moved files:' + files.length)
                    return true
                }
            }
            catch (error) {
                alert('move files error')
                return false
            }
        };  //end of MoveFiles
Title: Re: v1/files/move fails to throw error when file to be moved is locked
Post by: Mario on April 07, 2019, 02:24:19 PM
What did IMWS return? Did you check the Network tab in your browser?
Your exception handler will only be called when IMatch returns something other than 200 OK.

IMWS should receive an error message from Windows and promote that to the client.
Title: Re: v1/files/move fails to throw error when file to be moved is locked
Post by: ubacher on April 07, 2019, 03:01:00 PM
IMWS returns 200!

Title: Re: v1/files/move fails to throw error when file to be moved is locked
Post by: Mario on April 07, 2019, 03:24:08 PM
Then the operation succeeded or Windows did not return an error message to IMatch.
I shall investigate this at some later time.
Open a bug report so I can schedule a time slot.