add try/catch blocks when setting state