Throw errors for correct error reporting