Skip to content

Commit e68eb48

Browse files
YasserB94veewee
authored andcommitted
GenConfigCommand - print wsdl loading exceptions when output is verbose (#610)
GenerateConfigCommand - always print wsdl loading errors
1 parent d052757 commit e68eb48

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/Phpro/SoapClient/Console/Command/GenerateConfigCommand.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6262
$context->setWsdl($wsdlUri);
6363

6464
$io->warning('Attempting to load WSDL... (this might take a while)');
65-
$wsdl = $this->loadWsdl($wsdlUri);
6665

67-
if (!$wsdl) {
66+
try {
67+
$wsdl = $this->loadWsdl($wsdlUri);
68+
} catch (\Throwable $e) {
6869
$io->warning('Could not load the provided WSDL with default engine options.');
70+
$io->error([$e::class,$e->getMessage()]);
71+
if ($output->isVeryVerbose()) {
72+
$io->text(explode("\n", $e->getTraceAsString()));
73+
}
6974
$io->info('Continuing generating configuration...');
75+
$wsdl = null;
7076
}
7177

78+
7279
$context->setDetectedXmlNamespaces($wsdl?->namespaces->namespaceToNameMap ?? []);
7380
$context->setGenerateDocblocks($io->confirm('Should methods be generated with docblocks?', true));
7481
$name = $io->ask(
@@ -107,15 +114,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
107114
return self::SUCCESS;
108115
}
109116

110-
private function loadWsdl(string $wsdl): ?Wsdl1
117+
private function loadWsdl(string $wsdl): Wsdl1
111118
{
112-
try {
113119
$options = EngineOptions::defaults($wsdl);
114120
$loader = $options->getWsdlLoader();
115121

116122
return (new Wsdl1Reader($loader))($wsdl);
117-
} catch (\Throwable) {
118-
return null;
119-
}
120123
}
121124
}

0 commit comments

Comments
 (0)