Remove panic and only log the error.