Move errors to variables so they can be matched against

I've moved all errors to vars so they can be compared against