Skip to content

Commit db73603

Browse files
authored
YQ-3836 improved metadata objects errors (#12486)
1 parent 094be61 commit db73603

25 files changed

+361
-349
lines changed

ydb/core/external_sources/external_data_source.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct TExternalDataSource : public IExternalSource {
1717

1818
virtual TString Pack(const NKikimrExternalSources::TSchema&,
1919
const NKikimrExternalSources::TGeneral&) const override {
20-
ythrow TExternalSourceException() << "Only external table supports pack operation";
20+
ythrow TExternalSourceException() << "Internal error. Only external table supports pack operation";
2121
}
2222

2323
virtual TString GetName() const override {
@@ -33,7 +33,7 @@ struct TExternalDataSource : public IExternalSource {
3333
}
3434

3535
virtual TMap<TString, TVector<TString>> GetParameters(const TString&) const override {
36-
ythrow TExternalSourceException() << "Only external table supports parameters";
36+
ythrow TExternalSourceException() << "Internal error. Only external table supports parameters";
3737
}
3838

3939
bool DataSourceMustHaveDataBaseName(const TProtoStringType& sourceType) const {
@@ -50,16 +50,16 @@ struct TExternalDataSource : public IExternalSource {
5050
if (AvailableProperties.contains(key)) {
5151
continue;
5252
}
53-
ythrow TExternalSourceException() << "Unsupported property: " << key;
53+
throw TExternalSourceException() << "Unsupported property: " << key;
5454
}
5555

5656
if (DataSourceMustHaveDataBaseName(proto.GetSourceType()) && !proto.GetProperties().GetProperties().contains("database_name")) {
57-
ythrow TExternalSourceException() << proto.GetSourceType() << " source must provide database_name";
57+
throw TExternalSourceException() << proto.GetSourceType() << " source must provide database_name";
5858
}
5959

6060
// oracle must have property service_name
6161
if (proto.GetSourceType() == "Oracle" && !proto.GetProperties().GetProperties().contains("service_name")) {
62-
ythrow TExternalSourceException() << proto.GetSourceType() << " source must provide service_name";
62+
throw TExternalSourceException() << proto.GetSourceType() << " source must provide service_name";
6363
}
6464

6565
ValidateHostname(HostnamePatterns, proto.GetLocation());

ydb/core/external_sources/external_source_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct TExternalSourceFactory : public IExternalSourceFactory {
2323
if (it != Sources.end()) {
2424
return it->second;
2525
}
26-
ythrow TExternalSourceException() << "External source with type " << type << " was not found";
26+
throw TExternalSourceException() << "External source with type " << type << " was not found";
2727
}
2828

2929
private:

ydb/core/external_sources/object_storage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ struct TObjectStorageExternalSource : public IExternalSource {
7070
} else if (IsIn({"file_pattern"sv, "data.interval.unit"sv, "data.datetime.format_name"sv, "data.datetime.format"sv, "data.timestamp.format_name"sv, "data.timestamp.format"sv, "data.date.format"sv, "csv_delimiter"sv}, lowerKey)) {
7171
objectStorage.mutable_format_setting()->insert({lowerKey, value});
7272
} else {
73-
ythrow TExternalSourceException() << "Unknown attribute " << key;
73+
throw TExternalSourceException() << "Unknown attribute " << key;
7474
}
7575
}
7676

7777
if (auto issues = Validate(schema, objectStorage, PathsLimit, general.location())) {
78-
ythrow TExternalSourceException() << issues.ToString();
78+
throw TExternalSourceException() << issues.ToString();
7979
}
8080

8181
return objectStorage.SerializeAsString();
@@ -136,7 +136,7 @@ struct TObjectStorageExternalSource : public IExternalSource {
136136
}
137137

138138
if (!proto.GetProperties().GetProperties().empty()) {
139-
ythrow TExternalSourceException() << "ObjectStorage source doesn't support any properties";
139+
throw TExternalSourceException() << "ObjectStorage source doesn't support any properties";
140140
}
141141

142142
ValidateHostname(HostnamePatterns, proto.GetLocation());
@@ -546,7 +546,7 @@ struct TObjectStorageExternalSource : public IExternalSource {
546546
if (value.Success()) {
547547
return value.Metadata;
548548
}
549-
ythrow TExternalSourceException{} << value.Issues().ToOneLineString();
549+
throw TExternalSourceException{} << value.Issues().ToOneLineString();
550550
});
551551
}
552552

ydb/core/external_sources/validation_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void ValidateHostname(const std::vector<TRegExMatch>& hostnamePatterns, const TS
2626
}
2727
}
2828

29-
ythrow TExternalSourceException() << "It is not allowed to access hostname '" << hostname << "'";
29+
throw TExternalSourceException() << "It is not allowed to access hostname '" << hostname << "'";
3030
}
3131

3232
} // NKikimr::NExternalSource

0 commit comments

Comments
 (0)