Changed error constructor to throwError