try and catch error, and return status -1 if error occurs
store status code to db