Hi,
I'd like to insert the error message into a field, so I used try catch with both of them updating a variable, which I then used to update the field. Weird; it only updated on success, not on error. Can anyone help?
let config = input.config();
const recordId = config.recordid;
let tabletable = config.tabletable;
let table = base.getTable(tabletable);
let query = await table.selectRecordsAsync({ fields: ["Error"] });
let err;
try {
await table.updateRecordAsync(recordId, {
"Eat": "Cheese" // no such field
})
err = "Code executed successfully";
} catch (error) {
err = error.message;
} finally {
console.log(err);
await table.updateRecordAsync(recordId, {
"Error": err
}
);
}
console.log("Updated a record!");
CONSOLE.LOG
"Could not find a field with name or ID "Eat"."
ERROR
Error: Could not find a field with name or ID "Eat".
at main on line 16
As you can see, err was properly logged. But the record was not updated.