error handle

error handle for the solve function