Add test and implementation for an error occurring