Fix validation messages of code monitor query
Created by: eseliger
Currently, the message for missing patternType is never shown, so I had to look in the code to figure out how it's supposed to work, because the error message was just generic a 'Failed to parse query'. This fixes it by reordering the conditions. One open question: For queries that have no pattern specified, it always returns failed to parse query currently. Is that desired? It seems not and I removed that check for now.