catch SQL exceptions