Move error handling for registry into the declaration