Error trapping try vs. NSError

Hi All,

This is more of an oBJ-c question but in my ASOC project I have several OBJ-c classes and am trying to trap an error that is occurring while processing Address book info. What would be the equivalent of

repeat with i in list
  try
  ” some code that may stumble
  end try
end repeat

so the flow bypasses the error and keeps going?

or more complex:

repeat with i in list
  try
  ” some code that may stumble
on error the error_message number the error_number
  end try
end repeat

I have been perusing NSError and NSException but this is new territory and I am a bit confused with @try, @catch, @finally etc.

Thanks, Rob

You really shouldn’t be trying to trap errors like you do in AppleScript. (It’s something I found took a bit of adjusting to.)NSExceptions are considered the result of programming mistakes, but you can certainly make use of NSErrors.

Can you give us a bit of code that shows what you’re after?