Skip to content

Commit c5754df

Browse files
Mizuchimeta-codesync[bot]
authored andcommitted
Completely migrate ExceptionMetadata to schema.thrift
Reviewed By: iahs Differential Revision: D86644869 fbshipit-source-id: 0bbd859914ef18d54e6bd571cff2b39bc212220c
1 parent a900c0f commit c5754df

File tree

22 files changed

+236
-6
lines changed

22 files changed

+236
-6
lines changed

third-party/thrift/src/thrift/compiler/generate/templates/cpp2/module_metadata.cpp.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ StructMetadata<{{struct:cpp_fullname}}>::gen(ThriftMetadata& metadata) {
116116
{{#program:structs}}
117117
{{#struct:exception?}}
118118
void ExceptionMetadata<{{struct:cpp_fullname}}>::gen(ThriftMetadata& metadata) {
119+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
120+
genExceptionMetadata<{{struct:cpp_fullname}}>(metadata, kGenerateAll);
121+
return;
122+
}
123+
119124
auto res = genExceptionMetadata<{{struct:cpp_fullname}}>(metadata, {.genAnnotations = folly::kIsDebug});
120125
if (res.preExists) {
121126
return;

third-party/thrift/src/thrift/compiler/test/fixtures/any/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ StructMetadata<::facebook::thrift::compiler::test::fixtures::any::MyException>::
122122
}
123123

124124
void ExceptionMetadata<::facebook::thrift::compiler::test::fixtures::any::MyException>::gen(ThriftMetadata& metadata) {
125+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
126+
genExceptionMetadata<::facebook::thrift::compiler::test::fixtures::any::MyException>(metadata, kGenerateAll);
127+
return;
128+
}
129+
125130
auto res = genExceptionMetadata<::facebook::thrift::compiler::test::fixtures::any::MyException>(metadata, {.genAnnotations = folly::kIsDebug});
126131
if (res.preExists) {
127132
return;

third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ StructMetadata<::cpp2::SecretStruct>::gen(ThriftMetadata& metadata) {
206206
}
207207

208208
void ExceptionMetadata<::cpp2::detail::YourException>::gen(ThriftMetadata& metadata) {
209+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
210+
genExceptionMetadata<::cpp2::detail::YourException>(metadata, kGenerateAll);
211+
return;
212+
}
213+
209214
auto res = genExceptionMetadata<::cpp2::detail::YourException>(metadata, {.genAnnotations = folly::kIsDebug});
210215
if (res.preExists) {
211216
return;

third-party/thrift/src/thrift/compiler/test/fixtures/basic-structured-annotations/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ StructMetadata<::test::fixtures::basic_structured_annotations::MyUnion>::gen(Thr
321321
}
322322

323323
void ExceptionMetadata<::test::fixtures::basic_structured_annotations::MyException>::gen(ThriftMetadata& metadata) {
324+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
325+
genExceptionMetadata<::test::fixtures::basic_structured_annotations::MyException>(metadata, kGenerateAll);
326+
return;
327+
}
328+
324329
auto res = genExceptionMetadata<::test::fixtures::basic_structured_annotations::MyException>(metadata, {.genAnnotations = folly::kIsDebug});
325330
if (res.preExists) {
326331
return;

third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ StructMetadata<::test::fixtures::basic::UnionToBeRenamed>::gen(ThriftMetadata& m
317317
}
318318

319319
void ExceptionMetadata<::test::fixtures::basic::MyException>::gen(ThriftMetadata& metadata) {
320+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
321+
genExceptionMetadata<::test::fixtures::basic::MyException>(metadata, kGenerateAll);
322+
return;
323+
}
324+
320325
auto res = genExceptionMetadata<::test::fixtures::basic::MyException>(metadata, {.genAnnotations = folly::kIsDebug});
321326
if (res.preExists) {
322327
return;
@@ -347,6 +352,11 @@ void ExceptionMetadata<::test::fixtures::basic::MyException>::gen(ThriftMetadata
347352
));
348353
}
349354
void ExceptionMetadata<::test::fixtures::basic::MyExceptionWithMessage>::gen(ThriftMetadata& metadata) {
355+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
356+
genExceptionMetadata<::test::fixtures::basic::MyExceptionWithMessage>(metadata, kGenerateAll);
357+
return;
358+
}
359+
350360
auto res = genExceptionMetadata<::test::fixtures::basic::MyExceptionWithMessage>(metadata, {.genAnnotations = folly::kIsDebug});
351361
if (res.preExists) {
352362
return;

third-party/thrift/src/thrift/compiler/test/fixtures/bidi/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ StructMetadata<::cpp2::BiDiMethodException>::gen(ThriftMetadata& metadata) {
126126
}
127127

128128
void ExceptionMetadata<::cpp2::BiDiSinkException>::gen(ThriftMetadata& metadata) {
129+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
130+
genExceptionMetadata<::cpp2::BiDiSinkException>(metadata, kGenerateAll);
131+
return;
132+
}
133+
129134
auto res = genExceptionMetadata<::cpp2::BiDiSinkException>(metadata, {.genAnnotations = folly::kIsDebug});
130135
if (res.preExists) {
131136
return;
@@ -156,6 +161,11 @@ void ExceptionMetadata<::cpp2::BiDiSinkException>::gen(ThriftMetadata& metadata)
156161
));
157162
}
158163
void ExceptionMetadata<::cpp2::BiDiStreamException>::gen(ThriftMetadata& metadata) {
164+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
165+
genExceptionMetadata<::cpp2::BiDiStreamException>(metadata, kGenerateAll);
166+
return;
167+
}
168+
159169
auto res = genExceptionMetadata<::cpp2::BiDiStreamException>(metadata, {.genAnnotations = folly::kIsDebug});
160170
if (res.preExists) {
161171
return;
@@ -186,6 +196,11 @@ void ExceptionMetadata<::cpp2::BiDiStreamException>::gen(ThriftMetadata& metadat
186196
));
187197
}
188198
void ExceptionMetadata<::cpp2::BiDiMethodException>::gen(ThriftMetadata& metadata) {
199+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
200+
genExceptionMetadata<::cpp2::BiDiMethodException>(metadata, kGenerateAll);
201+
return;
202+
}
203+
189204
auto res = genExceptionMetadata<::cpp2::BiDiMethodException>(metadata, {.genAnnotations = folly::kIsDebug});
190205
if (res.preExists) {
191206
return;

third-party/thrift/src/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,11 @@ StructMetadata<::cpp2::Containers>::gen(ThriftMetadata& metadata) {
503503
}
504504

505505
void ExceptionMetadata<::cpp2::emptyXcep>::gen(ThriftMetadata& metadata) {
506+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
507+
genExceptionMetadata<::cpp2::emptyXcep>(metadata, kGenerateAll);
508+
return;
509+
}
510+
506511
auto res = genExceptionMetadata<::cpp2::emptyXcep>(metadata, {.genAnnotations = folly::kIsDebug});
507512
if (res.preExists) {
508513
return;
@@ -517,6 +522,11 @@ void ExceptionMetadata<::cpp2::emptyXcep>::gen(ThriftMetadata& metadata) {
517522
));
518523
}
519524
void ExceptionMetadata<::cpp2::reqXcep>::gen(ThriftMetadata& metadata) {
525+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
526+
genExceptionMetadata<::cpp2::reqXcep>(metadata, kGenerateAll);
527+
return;
528+
}
529+
520530
auto res = genExceptionMetadata<::cpp2::reqXcep>(metadata, {.genAnnotations = folly::kIsDebug});
521531
if (res.preExists) {
522532
return;
@@ -547,6 +557,11 @@ void ExceptionMetadata<::cpp2::reqXcep>::gen(ThriftMetadata& metadata) {
547557
));
548558
}
549559
void ExceptionMetadata<::cpp2::optXcep>::gen(ThriftMetadata& metadata) {
560+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
561+
genExceptionMetadata<::cpp2::optXcep>(metadata, kGenerateAll);
562+
return;
563+
}
564+
550565
auto res = genExceptionMetadata<::cpp2::optXcep>(metadata, {.genAnnotations = folly::kIsDebug});
551566
if (res.preExists) {
552567
return;
@@ -577,6 +592,11 @@ void ExceptionMetadata<::cpp2::optXcep>::gen(ThriftMetadata& metadata) {
577592
));
578593
}
579594
void ExceptionMetadata<::cpp2::complexException>::gen(ThriftMetadata& metadata) {
595+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
596+
genExceptionMetadata<::cpp2::complexException>(metadata, kGenerateAll);
597+
return;
598+
}
599+
580600
auto res = genExceptionMetadata<::cpp2::complexException>(metadata, {.genAnnotations = folly::kIsDebug});
581601
if (res.preExists) {
582602
return;

third-party/thrift/src/thrift/compiler/test/fixtures/cpp2-struct-footprint/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ StructMetadata<::cpp2_struct_footprint::TestUnion>::gen(ThriftMetadata& metadata
246246
}
247247

248248
void ExceptionMetadata<::cpp2_struct_footprint::ExStruct>::gen(ThriftMetadata& metadata) {
249+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
250+
genExceptionMetadata<::cpp2_struct_footprint::ExStruct>(metadata, kGenerateAll);
251+
return;
252+
}
253+
249254
auto res = genExceptionMetadata<::cpp2_struct_footprint::ExStruct>(metadata, {.genAnnotations = folly::kIsDebug});
250255
if (res.preExists) {
251256
return;

third-party/thrift/src/thrift/compiler/test/fixtures/doctext/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ StructMetadata<::cpp2::Bang>::gen(ThriftMetadata& metadata) {
144144
}
145145

146146
void ExceptionMetadata<::cpp2::Bang>::gen(ThriftMetadata& metadata) {
147+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
148+
genExceptionMetadata<::cpp2::Bang>(metadata, kGenerateAll);
149+
return;
150+
}
151+
147152
auto res = genExceptionMetadata<::cpp2::Bang>(metadata, {.genAnnotations = folly::kIsDebug});
148153
if (res.preExists) {
149154
return;

third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/cpp2/gen-cpp2/module_metadata.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ StructMetadata<::cpp2::Banal>::gen(ThriftMetadata& metadata) {
233233
}
234234

235235
void ExceptionMetadata<::cpp2::Fiery>::gen(ThriftMetadata& metadata) {
236+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
237+
genExceptionMetadata<::cpp2::Fiery>(metadata, kGenerateAll);
238+
return;
239+
}
240+
236241
auto res = genExceptionMetadata<::cpp2::Fiery>(metadata, {.genAnnotations = folly::kIsDebug});
237242
if (res.preExists) {
238243
return;
@@ -263,6 +268,11 @@ void ExceptionMetadata<::cpp2::Fiery>::gen(ThriftMetadata& metadata) {
263268
));
264269
}
265270
void ExceptionMetadata<::cpp2::Serious>::gen(ThriftMetadata& metadata) {
271+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
272+
genExceptionMetadata<::cpp2::Serious>(metadata, kGenerateAll);
273+
return;
274+
}
275+
266276
auto res = genExceptionMetadata<::cpp2::Serious>(metadata, {.genAnnotations = folly::kIsDebug});
267277
if (res.preExists) {
268278
return;
@@ -293,6 +303,11 @@ void ExceptionMetadata<::cpp2::Serious>::gen(ThriftMetadata& metadata) {
293303
));
294304
}
295305
void ExceptionMetadata<::cpp2::ComplexFieldNames>::gen(ThriftMetadata& metadata) {
306+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
307+
genExceptionMetadata<::cpp2::ComplexFieldNames>(metadata, kGenerateAll);
308+
return;
309+
}
310+
296311
auto res = genExceptionMetadata<::cpp2::ComplexFieldNames>(metadata, {.genAnnotations = folly::kIsDebug});
297312
if (res.preExists) {
298313
return;
@@ -323,6 +338,11 @@ void ExceptionMetadata<::cpp2::ComplexFieldNames>::gen(ThriftMetadata& metadata)
323338
));
324339
}
325340
void ExceptionMetadata<::cpp2::CustomFieldNames>::gen(ThriftMetadata& metadata) {
341+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
342+
genExceptionMetadata<::cpp2::CustomFieldNames>(metadata, kGenerateAll);
343+
return;
344+
}
345+
326346
auto res = genExceptionMetadata<::cpp2::CustomFieldNames>(metadata, {.genAnnotations = folly::kIsDebug});
327347
if (res.preExists) {
328348
return;
@@ -353,6 +373,11 @@ void ExceptionMetadata<::cpp2::CustomFieldNames>::gen(ThriftMetadata& metadata)
353373
));
354374
}
355375
void ExceptionMetadata<::cpp2::ExceptionWithPrimitiveField>::gen(ThriftMetadata& metadata) {
376+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
377+
genExceptionMetadata<::cpp2::ExceptionWithPrimitiveField>(metadata, kGenerateAll);
378+
return;
379+
}
380+
356381
auto res = genExceptionMetadata<::cpp2::ExceptionWithPrimitiveField>(metadata, {.genAnnotations = folly::kIsDebug});
357382
if (res.preExists) {
358383
return;
@@ -383,6 +408,11 @@ void ExceptionMetadata<::cpp2::ExceptionWithPrimitiveField>::gen(ThriftMetadata&
383408
));
384409
}
385410
void ExceptionMetadata<::cpp2::ExceptionWithStructuredAnnotation>::gen(ThriftMetadata& metadata) {
411+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
412+
genExceptionMetadata<::cpp2::ExceptionWithStructuredAnnotation>(metadata, kGenerateAll);
413+
return;
414+
}
415+
386416
auto res = genExceptionMetadata<::cpp2::ExceptionWithStructuredAnnotation>(metadata, {.genAnnotations = folly::kIsDebug});
387417
if (res.preExists) {
388418
return;
@@ -413,6 +443,11 @@ void ExceptionMetadata<::cpp2::ExceptionWithStructuredAnnotation>::gen(ThriftMet
413443
));
414444
}
415445
void ExceptionMetadata<::cpp2::Banal>::gen(ThriftMetadata& metadata) {
446+
if (FLAGS_thrift_enable_schema_to_metadata_conversion) {
447+
genExceptionMetadata<::cpp2::Banal>(metadata, kGenerateAll);
448+
return;
449+
}
450+
416451
auto res = genExceptionMetadata<::cpp2::Banal>(metadata, {.genAnnotations = folly::kIsDebug});
417452
if (res.preExists) {
418453
return;

0 commit comments

Comments
 (0)