Add exception handling to submit()