replace console.assert with exception