Search in a 2D array to find if there is a row or a column that contains the word “error” in every cell of that row or column
My Java is a bit rusty but I'm not seeing any logical issues with the code doing what you want it to.

Since you return just the row or column index, the caller can't tell from that if the match was a row or a column.