error catching on db