Error handling in jquery

shape