Better error handling to separate various errors