[IOT-1248] Fix multiple APIs throwing wrong exception