return an error instead of raising an exception