error handling

error handling when script loaded