                     // value here (string, int, double, data, null). If such an
                     // error happens, we'll switch to JSON decoding.
                     return try T(from: RowSingleValueDecoder(row: row, codingPath: codingPath + [key]))
-                } catch let error as DecodingError {
-                    if case .typeMismatch(_, let context) = error,
-                        context.debugDescription == "keyed decoding is not supported" || context.debugDescription == "unkeyed decoding is not supported",
-                        let data = row.dataNoCopy(atIndex: index)
-                    {
+                } catch let error as JSONDecodingRequiredError {
+                    if let data = row.dataNoCopy(atIndex: index) {
                         return try JSONDecoder().decode(type.self, from: data)
                     } else {
                         throw error

    }
    
    func unkeyedContainer() throws -> UnkeyedDecodingContainer {
        throw DecodingError.typeMismatch(
            UnkeyedDecodingContainer.self,
            DecodingError.Context(codingPath: codingPath, debugDescription: "unkeyed decoding is not supported"))
    }
    
    func singleValueContainer() throws -> SingleValueDecodingContainer {
        throw DecodingError.typeMismatch(
            RowDecoder.self,
            DecodingError.Context(codingPath: codingPath, debugDescription: "single value decoding is not supported"))
    }
}


                    // value here (string, int, double, data, null). If such an
                    // error happens, we'll switch to JSON decoding.
                    return try T(from: RowSingleValueDecoder(row: row, codingPath: codingPath + [key]))
                } catch let error as JSONDecodingRequiredError {
                    if let data = row.dataNoCopy(atIndex: index) {
                        return try JSONDecoder().decode(type.self, from: data)
                    } else {
                        throw error
