Adding handel error functionality