@throws js code example Example 1: js throw error throw new Error('Whoops!') Example 2: how to raise exception in js throw new Error('Exception message');