Adds an error domain and codes for some error scenarios

Adds an error domain and codes for some error scenarios which before would use @"" and 0 as domain and code, respectively.