Error handling

All the functions under Error handling