{
    "mode": "perldoc",
    "parameter": "Error::TypeTiny",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Error%3A%3ATypeTiny/json",
    "generated": "2026-06-11T11:49:17Z",
    "synopsis": "use Data::Dumper;\nuse Try::Tiny;\nuse Types::Standard qw(Str);\ntry {\nStr->assertvalid(undef);\n}\ncatch {\nmy $exception = shift;\nwarn \"Encountered Error: $exception\";\nwarn Dumper($exception->explain)\nif $exception->isa(\"Error::TypeTiny::Assertion\");\n};",
    "sections": {
        "NAME": {
            "content": "Error::TypeTiny - exceptions for Type::Tiny and friends\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Data::Dumper;\nuse Try::Tiny;\nuse Types::Standard qw(Str);\n\ntry {\nStr->assertvalid(undef);\n}\ncatch {\nmy $exception = shift;\nwarn \"Encountered Error: $exception\";\nwarn Dumper($exception->explain)\nif $exception->isa(\"Error::TypeTiny::Assertion\");\n};\n",
            "subsections": []
        },
        "STATUS": {
            "content": "This module is covered by the Type-Tiny stability policy.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "When Type::Tiny and its related modules encounter an error, they throw an exception object.\nThese exception objects inherit from Error::TypeTiny.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "\"new(%attributes)\"\nMoose-style constructor function.\n\n\"throw(%attributes)\"\nConstructs an exception and passes it to \"die\".\n\nAutomatically populates \"context\" and \"stacktrace\" if appropriate.\n"
                },
                {
                    "name": "Attributes",
                    "content": "\"message\"\nThe error message.\n\n\"context\"\nHashref containing the package, file and line that generated the error.\n\n\"stacktrace\"\nA more complete stack trace. This feature requires Devel::StackTrace; use the $StackTrace\npackage variable to switch it on.\n"
                },
                {
                    "name": "Methods",
                    "content": "\"tostring\"\nReturns the message, followed by the context if it is set.\n"
                },
                {
                    "name": "Functions",
                    "content": "\"Error::TypeTiny::croak($format, @args)\"\nFunctional-style shortcut to \"throw\" method. Takes an \"sprintf\"-style format string and\noptional arguments to construct the \"message\".\n"
                },
                {
                    "name": "Overloading",
                    "content": "*   Stringification is overloaded to call \"tostring\".\n"
                },
                {
                    "name": "Package Variables",
                    "content": "%Error::TypeTiny::CarpInternal\nServes a similar purpose to %Carp::CarpInternal.\n\n$Error::TypeTiny::StackTrace\nBoolean to toggle stack trace generation.\n\n$Error::TypeTiny::LastError\nA reference to the last exception object thrown.\n"
                }
            ]
        },
        "CAVEATS": {
            "content": "Although Error::TypeTiny objects are thrown for errors produced by Type::Tiny, that doesn't mean\nevery time you use Type::Tiny you'll get Error::TypeTinys whenever you want.\n\nFor example, if you use a Type::Tiny type constraint in a Moose attribute, Moose will not call\nthe constraint's \"assertvalid\" method (which throws an exception). Instead it will call \"check\"\nand \"getmessage\" (which do not), and will \"confess\" an error message of its own. (The\n$LastError package variable may save your bacon.)\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please report any bugs to <https://github.com/tobyink/p5-type-tiny/issues>.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Error::TypeTiny::Assertion, Error::TypeTiny::WrongNumberOfParameters.\n\nTry::Tiny, Try::Tiny::ByClass.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Toby Inkster <tobyink@cpan.org>.\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENCE": {
            "content": "This software is copyright (c) 2013-2014, 2017-2021 by Toby Inkster.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        },
        "DISCLAIMER OF WARRANTIES": {
            "content": "THIS PACKAGE IS PROVIDED \"AS IS\" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\nWITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.\n",
            "subsections": []
        }
    },
    "summary": "Error::TypeTiny - exceptions for Type::Tiny and friends",
    "flags": [],
    "examples": [],
    "see_also": []
}