NAME

Geo::Location::IP::Error::AddressNotFound - Error class for IP addresses

VERSION

version 0.002

SYNOPSIS

use 5.036;
use Geo::Location::IP::Database::Reader;
my $reader = Geo::Location::IP::Database::Reader->new(
  file => '/path/to/Country.mmdb'
);
local $@;
eval {
  my $country_model = $reader->country(ip => '192.0.2.1');
};
if (my $e = $@) {
  if ($e isa 'Geo::Location::IP::Error::AddressNotFound') {
    warn $e->ip_address, ' not found';
  }
}

DESCRIPTION

An error class that signals a non-existing IP address in a geolocation database.

SUBROUTINES/METHODS

throw

Geo::Location::IP::Error::AddressNotFound->throw(
  message    => "No record found for IP address $ip_address",
  ip_address => $ip_address,
);

Raises an exception with the specified message and a Geo::Location::IP::Address object.

message

my $message = $e->message;

Returns the message.

ip_address

my $ip_address = $e->ip_address;

Returns the IP address as a Geo::Location::IP::Address object.

DIAGNOSTICS

None.

CONFIGURATION AND ENVIRONMENT

None.

DEPENDENCIES

None.

INCOMPATIBILITIES

None.

BUGS AND LIMITATIONS

None known.

AUTHOR

Andreas Vögele <voegelas@cpan.org>

LICENSE AND COPYRIGHT

Copyright (C) 2025 Andreas Vögele

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.