Refactor: added function for errordetail