@@ -1318,23 +1318,30 @@ private IEnumerator CheckLanguageModelStatus()
1318
1318
1319
1319
Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "Attempting to GetLanguageModel..." ) ;
1320
1320
LanguageModel getLanguageModelResponse = null ;
1321
- service . GetLanguageModel (
1322
- callback : ( DetailedResponse < LanguageModel > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1323
- {
1324
- getLanguageModelResponse = response . Result ;
1325
- Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckLanguageModelStatus: {0}" , getLanguageModelResponse . Status ) ;
1326
- if ( getLanguageModelResponse . Status == LanguageModel . StatusValue . TRAINING )
1327
- {
1328
- Runnable . Run ( CheckLanguageModelStatus ( ) ) ;
1329
- }
1330
- else
1321
+ try
1322
+ {
1323
+ service . GetLanguageModel (
1324
+ callback : ( DetailedResponse < LanguageModel > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1331
1325
{
1332
- isLanguageModelReady = true ;
1333
- }
1334
- } ,
1335
- customizationId : customizationId ,
1336
- customData : customData
1337
- ) ;
1326
+ getLanguageModelResponse = response . Result ;
1327
+ Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckLanguageModelStatus: {0}" , getLanguageModelResponse . Status ) ;
1328
+ if ( getLanguageModelResponse . Status == LanguageModel . StatusValue . TRAINING )
1329
+ {
1330
+ Runnable . Run ( CheckLanguageModelStatus ( ) ) ;
1331
+ }
1332
+ else
1333
+ {
1334
+ isLanguageModelReady = true ;
1335
+ }
1336
+ } ,
1337
+ customizationId : customizationId ,
1338
+ customData : customData
1339
+ ) ;
1340
+ }
1341
+ catch
1342
+ {
1343
+ Runnable . Run ( CheckLanguageModelStatus ( ) ) ;
1344
+ }
1338
1345
1339
1346
while ( getLanguageModelResponse == null )
1340
1347
yield return null ;
@@ -1349,24 +1356,31 @@ private IEnumerator CheckCorpusStatus()
1349
1356
1350
1357
Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "Attempting to GetCorpus..." ) ;
1351
1358
Corpus getCorpusResponse = null ;
1352
- service . GetCorpus (
1353
- callback : ( DetailedResponse < Corpus > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1354
- {
1355
- getCorpusResponse = response . Result ;
1356
- Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckCorpusStatus: {0}" , getCorpusResponse . Status ) ;
1357
- if ( getCorpusResponse . Status != Corpus . StatusValue . ANALYZED )
1358
- {
1359
- Runnable . Run ( CheckCorpusStatus ( ) ) ;
1360
- }
1361
- else
1359
+ try
1360
+ {
1361
+ service . GetCorpus (
1362
+ callback : ( DetailedResponse < Corpus > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1362
1363
{
1363
- isCorpusReady = true ;
1364
- }
1365
- } ,
1366
- customizationId : customizationId ,
1367
- corpusName : corpusName ,
1368
- customData : customData
1369
- ) ;
1364
+ getCorpusResponse = response . Result ;
1365
+ Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckCorpusStatus: {0}" , getCorpusResponse . Status ) ;
1366
+ if ( getCorpusResponse . Status != Corpus . StatusValue . ANALYZED )
1367
+ {
1368
+ Runnable . Run ( CheckCorpusStatus ( ) ) ;
1369
+ }
1370
+ else
1371
+ {
1372
+ isCorpusReady = true ;
1373
+ }
1374
+ } ,
1375
+ customizationId : customizationId ,
1376
+ corpusName : corpusName ,
1377
+ customData : customData
1378
+ ) ;
1379
+ }
1380
+ catch
1381
+ {
1382
+ Runnable . Run ( CheckCorpusStatus ( ) ) ;
1383
+ }
1370
1384
1371
1385
while ( getCorpusResponse == null )
1372
1386
yield return null ;
@@ -1381,23 +1395,30 @@ private IEnumerator CheckGrammarsStatus()
1381
1395
1382
1396
Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "Attempting to GetGrammar..." ) ;
1383
1397
Grammar getGrammarResponse = null ;
1384
- service . GetGrammar (
1385
- callback : ( DetailedResponse < Grammar > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1386
- {
1387
- getGrammarResponse = response . Result ;
1388
- if ( getGrammarResponse . Status != Grammar . StatusValue . ANALYZED )
1389
- {
1390
- Runnable . Run ( CheckGrammarsStatus ( ) ) ;
1391
- }
1392
- else
1398
+ try
1399
+ {
1400
+ service . GetGrammar (
1401
+ callback : ( DetailedResponse < Grammar > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1393
1402
{
1394
- isGrammarsReady = true ;
1395
- }
1396
- } ,
1397
- customizationId : customizationId ,
1398
- grammarName : grammarName ,
1399
- customData : customData
1400
- ) ;
1403
+ getGrammarResponse = response . Result ;
1404
+ if ( getGrammarResponse . Status != Grammar . StatusValue . ANALYZED )
1405
+ {
1406
+ Runnable . Run ( CheckGrammarsStatus ( ) ) ;
1407
+ }
1408
+ else
1409
+ {
1410
+ isGrammarsReady = true ;
1411
+ }
1412
+ } ,
1413
+ customizationId : customizationId ,
1414
+ grammarName : grammarName ,
1415
+ customData : customData
1416
+ ) ;
1417
+ }
1418
+ catch
1419
+ {
1420
+ Runnable . Run ( CheckGrammarsStatus ( ) ) ;
1421
+ }
1401
1422
1402
1423
while ( getGrammarResponse == null )
1403
1424
yield return null ;
@@ -1412,23 +1433,30 @@ private IEnumerator CheckAcousticModelStatus()
1412
1433
1413
1434
Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "Attempting to GetAcousticModel..." ) ;
1414
1435
AcousticModel getAcousticModelResponse = null ;
1415
- service . GetAcousticModel (
1416
- callback : ( DetailedResponse < AcousticModel > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1417
- {
1418
- getAcousticModelResponse = response . Result ;
1419
- Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckAcousticModelStatus: {0}" , getAcousticModelResponse . Status ) ;
1420
- if ( getAcousticModelResponse . Status != AcousticModel . StatusValue . READY )
1421
- {
1422
- Runnable . Run ( CheckAcousticModelStatus ( ) ) ;
1423
- }
1424
- else
1436
+ try
1437
+ {
1438
+ service . GetAcousticModel (
1439
+ callback : ( DetailedResponse < AcousticModel > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1425
1440
{
1426
- isAcousticModelReady = true ;
1427
- }
1428
- } ,
1429
- customizationId : acousticModelCustomizationId ,
1430
- customData : customData
1431
- ) ;
1441
+ getAcousticModelResponse = response . Result ;
1442
+ Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckAcousticModelStatus: {0}" , getAcousticModelResponse . Status ) ;
1443
+ if ( getAcousticModelResponse . Status != AcousticModel . StatusValue . READY )
1444
+ {
1445
+ Runnable . Run ( CheckAcousticModelStatus ( ) ) ;
1446
+ }
1447
+ else
1448
+ {
1449
+ isAcousticModelReady = true ;
1450
+ }
1451
+ } ,
1452
+ customizationId : acousticModelCustomizationId ,
1453
+ customData : customData
1454
+ ) ;
1455
+ }
1456
+ catch
1457
+ {
1458
+ Runnable . Run ( CheckAcousticModelStatus ( ) ) ;
1459
+ }
1432
1460
1433
1461
while ( getAcousticModelResponse == null )
1434
1462
yield return null ;
@@ -1443,25 +1471,32 @@ private IEnumerator CheckAudioStatus()
1443
1471
1444
1472
Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "Attempting to GetAudio..." ) ;
1445
1473
AudioListing getAudioResponse = null ;
1446
- service . GetAudio (
1447
- callback : ( DetailedResponse < AudioListing > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1448
- {
1449
- getAudioResponse = response . Result ;
1450
- Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckAudioStatus: {0}" , getAudioResponse . Status ) ;
1451
-
1452
- if ( getAudioResponse . Status != AudioListing . StatusValue . OK )
1453
- {
1454
- Runnable . Run ( CheckAudioStatus ( ) ) ;
1455
- }
1456
- else
1474
+ try
1475
+ {
1476
+ service . GetAudio (
1477
+ callback : ( DetailedResponse < AudioListing > response , IBMError error , Dictionary < string , object > customResponseData ) =>
1457
1478
{
1458
- isAudioReady = true ;
1459
- }
1460
- } ,
1461
- customizationId : acousticModelCustomizationId ,
1462
- audioName : acousticResourceName ,
1463
- customData : customData
1464
- ) ;
1479
+ getAudioResponse = response . Result ;
1480
+ Log . Debug ( "SpeechToTextServiceV1IntegrationTests" , "CheckAudioStatus: {0}" , getAudioResponse . Status ) ;
1481
+
1482
+ if ( getAudioResponse . Status != AudioListing . StatusValue . OK )
1483
+ {
1484
+ Runnable . Run ( CheckAudioStatus ( ) ) ;
1485
+ }
1486
+ else
1487
+ {
1488
+ isAudioReady = true ;
1489
+ }
1490
+ } ,
1491
+ customizationId : acousticModelCustomizationId ,
1492
+ audioName : acousticResourceName ,
1493
+ customData : customData
1494
+ ) ;
1495
+ }
1496
+ catch
1497
+ {
1498
+ Runnable . Run ( CheckAudioStatus ( ) ) ;
1499
+ }
1465
1500
1466
1501
while ( getAudioResponse == null )
1467
1502
yield return null ;
0 commit comments