Throwing an error when hook loads failed