I am having the same exact issue!!!
iMessage isn't throwing an error even though the messages are not delivered to SMS users. (so the on error block isn't ever running...
I wish that the send function returned something once it confirms the message was sent.
Does anyone have any ideas???? - I really need that on error catch block to run!
tell application "Messages"
set phoneNumber to "+15555555555"
set messageToSend to "This is a test!"
try
set iMessageService to (1st account whose service type = iMessage)
set iMessageBuddy to participant phoneNumber of iMessageService
send messageToSend to iMessageBuddy
log ("sent as iMessage to: " & phoneNumber)
on error
try
set iMessageService to (1st account whose service type = SMS)
set iMessageBuddy to participant phoneNumber of iMessageService
send messageToSend to iMessageBuddy
log ("sent as SMS to: " & phoneNumber)
on error
log ("ERROR: COULD NOT SEND TO: " & phoneNumber)
end try
end try
end tell