feat: improved handling of errors