Raise specific exceptions based on error code