add error middleware

fix #55 Sorry Allen!