pass error to frontend