GeoIP2...r::Type(3pm)

πŸ“¦
version 2.006002 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– GeoIP2::Error::Type β€” the manual, but make it cute πŸ’–

okay bestie, so this page lives in the User Contributed Perl Documentation corner of the internet, and the module we're talking about is literally called GeoIP2::Error::Type. It's giving "your type didn't pass the vibe check" energy, and I'm obsessed.


✨ NAME ✨

GeoIP2::Error::Type β€” a type validation error. That's it, that's the name, she's simple and she's iconic πŸ’…


🌸 VERSION 🌸

version 2.006002 β€” write it down, screenshot it, tattoo it, whatever works for you πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole thing, verbatim, don't touch a single character bestie:

  use 5.008;

  use GeoIP2::WebService::Client;
  use Scalar::Util qw( blessed );
  use Try::Tiny;

  my $client = GeoIP2::WebService::Client->new(
      account_id  => 42,
      license_key => 'abcdef123456',
  );

  try {
      $client->insights( ip => '24.24.24.24' );
  }
  catch {
      die $_ unless blessed $_;
      if ( $_->isa('GeoIP2::Error::Type') ) {
          log_validation_error(
              type   => $_->name(),
              value  => $_->value(),
          );
      }

      # handle other exceptions
  };

like, you wrap the call in try, and in the catch you check whether the thing you caught is even blessed at all β€” and if it is, and if it isa('GeoIP2::Error::Type'), you log the name and the value and move on with your life. no cap 🫢


🌈 DESCRIPTION 🌈

so this class? she represents a Moo type validation error. She extends Throwable::Error and then adds some attributes of her very own, because why just be a Throwable when you can be that girl ✨


πŸ‘‘ METHODS πŸ‘‘

listen, $error->message() and $error->stack_trace() are both inherited from Throwable::Error β€” you get those for free, they came with the outfit. But she also provides two methods of her own:

πŸ’œ $error->name()

Returns the name of the type which failed validation. That's the "who are you supposed to be" of the situation.

πŸ’œ $error->value()

Returns the value which triggered the validation failure. That's the "what did you actually show up wearing" of the situation. 😭


πŸ“ SUPPORT πŸ“

Got bugs? Same. Submit them through <https://github.com/maxmind/GeoIP2-perl/issues> and the maintainers will handle it β€” that's the whole support pipeline, no extra steps, periodt.


🧚 AUTHORS 🧚

these are the legends who made this happen, show them some respect:

  • Dave Rolsky <drolsky@maxmind.com>
  • Greg Oschwald <goschwald@maxmind.com>
  • Mark Fowler <mfowler@maxmind.com>
  • Olaf Alders <oalders@maxmind.com>

This software is copyright (c) 2013 - 2019 by MaxMind, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. So like, go forth, remix, redistribute, slay πŸ’…


ngl, that's the whole page β€” every flag, method, author and legal line, all accounted for. nothing skipped, nothing invented, we ate and left no crumbs 🫢

and that's a wrap bestie!! this beauty was rendered by perl v5.36.0 and stamped 2022-11-21, and the manual page name is GeoIP2::Error::Type(3pm). love that for her πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from