I mean, at the very least it seems like you should be comparing the enum field to an enum literal, not to an integer literal!
(Note that I do agree that the error here is quite ugly.)