CSS::D...ception(3pm)

πŸ“¦
version 0.17 Β· 5 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– CSS::DOM::Exception β€” the manual page, bestie edition πŸ’–

okay so you're reading CSS::D...ception(3pm), which is the User Contributed Perl Documentation version of CSS::DOM::Exception, and honestly? she's giving chaos management for CSS, and I'm obsessed. let's get into it 🫢


✨ NAME ✨

CSS::DOM::Exception β€” the Exception interface for CSS::DOM. no cap, that's literally her whole job πŸ’…


🌸 SYNOPSIS 🌸

use CSS::DOM::Exception 'SYNTAX_ERR';

eval {
        die new CSS::DOM::Exception
                SYNTAX_ERR,
                '1 is not a valid property declaration'
};

$@ == SYNTAX_ERR; # true

print $@;    # prints "1 is not a valid property declaration\n";

see how she just throws? iconic behavior fr fr ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

This module implements the W3C's DOMException interface. (yes, "implementations" is what the original says, we don't gatekeep grammar here, we gatekeep functionality 😭)

CSS::DOM::Exception objects stringify to the message that was passed to the constructor, and they numify to the error number. where do you find that error number, you ask? look below, under EXPORTS. iykyk πŸ’–


πŸŽ€ METHODS πŸŽ€

  • new CSS::DOM::Exception $type, $message β€” this class method creates a brand new exception object, like a little baby error 🍼. $type is expected to be an integer (you can totally use the constants listed under EXPORTS for this, they're right there bestie). $message is the error message. that's it. that's the whole method. slay ✨

πŸ‘‘ EXPORTS πŸ‘‘

The following constants are optionally exported. and the descriptions? copied straight from the DOM spec, so you know they're legit. let's go one by one, no skipping, we don't do that here πŸ’…

  • INDEX_SIZE_ERR (1) β€” if index or size is negative, or greater than the allowed value. she said "out of bounds? not on my watch" 🚫
  • DOMSTRING_SIZE_ERR (2) β€” if the specified range of text does not fit into a DOMString. too much text, not enough string, it's giving "your luggage doesn't fit in the overhead bin" πŸ’€
  • HIERARCHY_REQUEST_ERR (3) β€” if any node is inserted somewhere it doesn't belong. like me at a party i wasn't invited to πŸ™ˆ
  • WRONG_DOCUMENT_ERR (4) β€” if a node is used in a different document than the one that created it (that doesn't support it). cheating on your document?? in THIS economy?? 😭
  • INVALID_CHARACTER_ERR (5) β€” if an invalid character is specified, such as in a name. bestie that character is NOT on the guest list πŸŽ€
  • NO_DATA_ALLOWED_ERR (6) β€” if data is specified for a node which does not support data. she's a node who said "no data please" and we respect her boundaries 🫢
  • NO_MODIFICATION_ALLOWED_ERR (7) β€” if an attempt is made to modify an object where modifications are not allowed. read-only era. locked. do not perceive her πŸ’…
  • NOT_FOUND_ERR (8) β€” if an attempt was made to reference a node in a context where it does not exist. she's not here, she never was here, who are you talking about 🌈
  • NOT_SUPPORTED_ERR (9) β€” if the implementation does not support the type of object requested. respectfully? no ❌
  • INUSE_ATTRIBUTE_ERR (10) β€” if an attempt is made to add an attribute that is already inuse elsewhere. (yes, "inuse" as one word, that's the spec's typo and we're keeping it, character for character πŸ’–) that attribute is TAKEN, move on πŸ’€
  • INVALID_STATE_ERR (11) β€” if an attempt is made to use an object that is not, or is no longer, usable. expired. past her prime. out of the rotation 😭
  • SYNTAX_ERR (12) β€” if an invalid or illegal string is specified. this is the star of the SYNOPSIS, our main character πŸ‘‘
  • INVALID_MODIFICATION_ERR (13) β€” if an attempt is made to modify the type of the underlying object. you cannot rebrand her, she is who she is ✨
  • NAMESPACE_ERR (14) β€” if an attempt is made to create or change an object in a way which is incorrect with regard to namespaces. namespace drama. we've all been there πŸ¦‹
  • INVALID_ACCESS_ERR (15) β€” if a parameter or an operation is not supported by the underlying object. access denied, bestie, no keycard, no entry πŸšͺ

⭐ SEE ALSO ⭐

  • CSS::DOM
  • HTML::DOM::Exception

go read those too, they're part of the friend group 🌸


and that's the whole page, bestie! this was perl v5.36.0, dated 2023-08-02, and yes she really did call herself CSS::D...ception(3pm) in the footer like the icon she is πŸ’œ bye ily, go handle your exceptions responsibly πŸ”₯πŸ’–

πŸ“¦ where this page comes from