npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

w3c-domcore-errors

v1.0.2

Published

An implementation of the standard DOMException and DOMError interfaces

Downloads

222

Readme

W3C DOMCORE Errors

Provides the DOMException and DOMError W3C interfaces from the section 3 (Errors) of the DOM4 akka DOMCore W3C Working Draft. These interfaces are also defined in the WHATWG HTML5 Living standard.

These interfaces are useful if you want to provide standard Errors in your own APIs or in Polyfill libraries

This is available in NPM: https://npmjs.org/package/w3c-domcore-errors

How to use

var DOMException = require('w3c-domcore-errors').DOMException;
var InvalidCharacterError = new DOMException('InvalidCharacterError');

function myStringHandler(data) {
    if (!REGEX_VALID_STRING.test(data)) {
        throw InvalidCharacterError;
    }
    // do the job
}

Error Names

Name | Description | Legacy code exception field value (if any) ---------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------- "IndexSizeError" | The index is not in the allowed range. | INDEX_SIZE_ERR (1)
"HierarchyRequestError" | The operation would yield an incorrect node tree. | HIERARCHY_REQUEST_ERR (3) "WrongDocumentError" | The object is in the wrong document. | WRONG_DOCUMENT_ERR (4) "InvalidCharacterError" | The string contains invalid characters. | INVALID_CHARACTER_ERR (5) "NoModificationAllowedError" | The object can not be modified. | NO_MODIFICATION_ALLOWED_ERR (7) "NotFoundError" | The object can not be found here. | NOT_FOUND_ERR (8) "NotSupportedError" | The operation is not supported. | NOT_SUPPORTED_ERR (9) "InvalidStateError" | The object is in an invalid state. | INVALID_STATE_ERR (11) "SyntaxError" | The string did not match the expected pattern. | SYNTAX_ERR (12) "InvalidModificationError" | The object can not be modified in this way. | INVALID_MODIFICATION_ERR (13) "NamespaceError" | The operation is not allowed by Namespaces in XML. | NAMESPACE_ERR (14) "InvalidAccessError" | The object does not support the operation or argument. | INVALID_ACCESS_ERR (15) "SecurityError" | The operation is insecure. | SECURITY_ERR (18) "NetworkError" | A network error occurred. | NETWORK_ERR (19) "AbortError" | The operation was aborted. | ABORT_ERR (20) "URLMismatchError" | The given URL does not match another URL. | URL_MISMATCH_ERR (21) "QuotaExceededError" | The quota has been exceeded. | QUOTA_EXCEEDED_ERR (22) "TimeoutError" | The operation timed out. | TIMEOUT_ERR (23) "InvalidNodeTypeError" | The supplied node is incorrect or has an incorrect ancestor for this operation. | INVALID_NODE_TYPE_ERR (24) "DataCloneError" | The object can not be cloned. | DATA_CLONE_ERR (25) "EncodingError" | The encoding operation (either encoded or decoding) failed. | —

References

Current standards

DOM4

W3C Working Draft 6 December 2012 - Section 3: Errors

http://www.w3.org/TR/dom/#errors

WHATWG DOM

Living Standard - Section 3: Errors

http://dom.spec.whatwg.org/#errors

Previous standards

DOM Level 3 Core

W3C Recommendation 07 April 2004 - Section 1.4 Fundamental Interfaces: Core Module

http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-BBACDC08

Document Object Model (DOM) Level 2 Core

W3C Recommendation 13 November, 2000 - Section 1.2. Fundamental Interfaces

http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-BBACDC08

Document Object Model (Core) Level 1

W3C Recommendation 1 October, 1998 - Section 1.2. Fundamental Interfaces

http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-BBACDC08

Browser support.. Can I Use...

If Browsers implement DOMException, DOMError is most of the time not implemented. I plan adapt this Polyfill to enhance Browser DOMError support, more specifically to provide DOMError as a constructor, as defined in the WHATWG edition of the specification.

I posted a feature request on caniuse.com to detect potential future implementations, so feel free to support it: http://www.google.com/moderator/#8/e=ae425&q=ae425.6c295c&v=4

License (MIT License)

Copyright (c) 2013 Alexandre Morgaut

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.