logo

cve-client

CLI-based client / toolbox for CVE.org
commit: 3dda0f9bfdbed239feed5394abd7883769b2a270
parent 96e8ed2730994fd69d2adfdc11148609e4632b1f
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  2 Oct 2021 23:02:31 +0200

Handle error sent from API

Diffstat:

Mcve-client.pl5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/cve-client.pl b/cve-client.pl @@ -28,6 +28,11 @@ sub print_cve { print "CVE ID: ", $cve_id, "\n\n"; + if ($object->{'error'} and $object->{'message'}) { + print "Error (", $object->{'error'}, "): ", $object->{'message'}, "\n"; + exit 1; + } + if ($object->{'data_version'} != "4.0") { print "Warning: Got unknown CVE format \"", $object->{'data_version'}, "\"\n";