Encapsulate error handling in tests
Use :error instead of :invalid to indicate failed operations
Fix error helper