Skip to content

Commit 3d800b1

Browse files
committed
Feature 110 - VIES CLI Client
Now using proper exit codes to indicate a non-zero result with failure occured.
1 parent be9ec63 commit 3d800b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bin/vatcheck

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ require_once __DIR__ . '/../vendor/autoload.php';
88

99
if (2 !== $argc) {
1010
echo 'Usage: ' . $argv[0] . ' <VATID>' . PHP_EOL;
11-
exit(0);
11+
exit(1);
1212
}
1313

1414
$vies = new Vies();
1515
if (false === $vies->getHeartBeat()->isAlive()) {
1616
echo 'EU VIES Service not available at this moment, please try again later' . PHP_EOL;
17-
exit(0);
17+
exit(2);
1818
}
1919

2020
$vatId = $vies->splitVatId($argv[1]);
@@ -24,10 +24,10 @@ try {
2424
$result = $vies->validateVat($vatId['country'], $vatId['id']);
2525
} catch (ViesServiceException $vse) {
2626
echo $vse->getMessage() . PHP_EOL;
27-
exit(1);
27+
exit(3);
2828
} catch (ViesException $ve) {
2929
echo $ve->getMessage() . PHP_EOL;
30-
exit(1);
30+
exit(4);
3131
}
3232

3333
echo sprintf(

0 commit comments

Comments
 (0)