Adding Enum to track errors better

Adding enum to handle error