throw correct error messages