update err to error