how capture errors from database

I am trying capture errors with “try”, but it seems that not work. What Can I do to capture a error from a call a sc_exec_sql call.? Now the application go down afters the error is showed
cheers.