don't print error output when no error occured

The 'create_ways' query is two concatenated commands with the last one being a SELECT query. So check, if that went OK.