refactor with compile
always stringify error object