Fixed #24014 -- Unified OGRException and GDALException

I had to check but it seems we have more occurrences of "backwards compatibility" as opposed to the dashed version.