You can do this if statement once to set a string accessor to 'displayError' or 'error' to use here and in the nested part.