Adding sendException method in Javascript.