simplified error object, reduced nesting in module