{"_id":"@ao-framework/exceptions","_rev":"2-58a6744ab6f5f882d42fd5908c9007f4","name":"@ao-framework/exceptions","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@ao-framework/exceptions","version":"0.0.1","description":"Exceptions is an abstract class for creating custom exceptions. It contains functionality to tag additional information about context that ultimately led to an exception to be thrown in the first place. Errors in Javascript contains the “toString” method ","main":"index.js","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc","doc":"typedoc --out docs src && touch docs/.nojekyll"},"devDependencies":{"@types/jest":"^22.2.0","@types/node":"^10.12.12","jest":"^22.4.2","typedoc":"^0.14.2","typescript":"^2.7.2"},"jest":{"testEnvironment":"node","collectCoverage":true,"collectCoverageFrom":["dist/src/**/*.js","!**dist/src/interfaces/**"],"verbose":true,"testURL":"http://localhost/"},"directories":{"doc":"docs","test":"test"},"repository":{"type":"git","url":"git+https://github.com/ao-framework/exceptions.git"},"author":"","license":"ISC","bugs":{"url":"https://github.com/ao-framework/exceptions/issues"},"homepage":"https://github.com/ao-framework/exceptions#readme","dependencies":{"@ao-framework/writer":"0.0.1"},"gitHead":"4f2775f99290112369e9038fc23a3c677338620e","_id":"@ao-framework/exceptions@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"josh-josh-miller","email":"wickedhillsmedia@gmail.com"},"dist":{"integrity":"sha512-47sTSgdeNFQmTrkUbYd1Vv14ETEcT1dY7md9zKcbKIZdhU6GCBhFcxrwa+S75BAF5gJYNZ13YpYp8mMVOknkPA==","shasum":"7bc15a3539af7b6b80c245e00015292b5a10d15a","tarball":"https://registry.npmjs.org/@ao-framework/exceptions/-/exceptions-0.0.1.tgz","fileCount":43,"unpackedSize":440048,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcmcNYCRA9TVsSAnZWagAAPnYQAJXO4vQAwkHpaaeKB8LO\nnXkEB8rXea3y14bMlgARth8ssKo1VvpKAGESqG6QXtkcYBMVUyQLrYm3Xkyq\nfP0G/S7ho6rIbY0iNu9nsAT2FvIofsIN7brYX8lhv84C981gNqrsQPy9AOoc\nZS7GOGPjIzAsT1Ss0/qavTvY2mt+F41Zx4M+XSA+Zc4E6WfdqZM/5ffD4QZG\ncgafR0F1A4Q/O9B+KQCqmblAiKJiidCL5YmPtLrFzwYIy9XZ5pu++meREpc2\n1wTqnscnKoaX4NwDV3p7dPQgqbR5ibnx+6t3TSOZSbwDZYEQqAaK/nWvC1T1\nLFp4Trq/uLMB9M0R3ABmO6G0h3PGNzxp8pZCc2vKpUpUiQ4Nonc/BBq/wtNe\nHWopkJjV9yoYHAkK4O5YoViAsQl1On7w8lX+98z4RMFQXMnSyc2Nb3TTxaBe\nRlmdbEJS23Rfa0B50lbfqKQIYlPWhxIloeHDJcVeC0Np6PYAis76AaIzJZPG\ncBWOKRC/9xgxuqs+vWkcLlVjf2SEiV3F9Xt8LjLOZ8eGngqTHlCJsu7GHd9T\npZ+IkOiSw2ZV8+jigk0UHEZYmpsIn82Stm18MYLpQox2azuaqgCFlpCeLZ4s\nktw9gcpzti7pm13mKocm4hUvBEkPt4eFLoNz/BYiNwoodd0+sIE9fkLnsnYy\n4qo7\r\n=z3Iv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDepT/tVmeGx8K+8jPAJLic3GH7tP7tlIDAlK4Q6R3xZAiEArMKC6jpsbwLYOzXhThoNuEJ1n079kMOdHsRPh4inhDs="}]},"maintainers":[{"name":"josh-josh-miller","email":"wickedhillsmedia@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exceptions_0.0.1_1553580888034_0.8410898100615574"},"_hasShrinkwrap":false},"0.0.2":{"name":"@ao-framework/exceptions","version":"0.0.2","description":"Exceptions is an abstract class for creating custom exceptions. It contains functionality to tag additional information about context that ultimately led to an exception to be thrown in the first place. Errors in Javascript contains the “toString” method ","main":"dist/src/index","types":"dist/src/index.d.ts","scripts":{"test":"jest","dev":"tsc --watch","build":"tsc","doc":"typedoc --out docs src && touch docs/.nojekyll"},"devDependencies":{"@types/jest":"^22.2.0","@types/node":"^10.12.12","jest":"^22.4.2","typedoc":"^0.14.2","typescript":"^2.7.2"},"jest":{"testEnvironment":"node","collectCoverage":true,"collectCoverageFrom":["dist/src/**/*.js","!**dist/src/interfaces/**"],"verbose":true,"testURL":"http://localhost/"},"directories":{"doc":"docs","test":"test"},"repository":{"type":"git","url":"git+https://github.com/ao-framework/exceptions.git"},"author":"","license":"ISC","bugs":{"url":"https://github.com/ao-framework/exceptions/issues"},"homepage":"https://github.com/ao-framework/exceptions#readme","dependencies":{"@ao-framework/writer":"0.0.1"},"gitHead":"37111b58cf4af6e167b1e65b4bcf1f373ac88121","_id":"@ao-framework/exceptions@0.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"josh-josh-miller","email":"wickedhillsmedia@gmail.com"},"dist":{"integrity":"sha512-+qyuNs4diPPsBWtKMLYyMf+7PFsHrgh3VidIfktskadUMPEGqr0mcIq73d58kqLLVHsq/daHFCZxD+u6ofy11g==","shasum":"670a2fe6b6fad0bb1b66e03dd1e48e8595a6b5d5","tarball":"https://registry.npmjs.org/@ao-framework/exceptions/-/exceptions-0.0.2.tgz","fileCount":85,"unpackedSize":458049,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcmmiwCRA9TVsSAnZWagAA8BgP/1LX9ddZGeRYcHhNIOm2\nBeg5aCY8YBZLS09Mx1CVeoSeuhq2ZrbsE9wvCaqHoj1Wv7icClRkAum7nQ9L\naBM5oJYx+PLToRT0WlL0MC0tGAzbG9+eUI2z72ZkjKv5ZBp+6CBJz6LpEVUk\njzilhId3X/ESE8taY6S4bRZg1DxyWuxmxHL9ceIyvaOc/uC9UUgoe0cpWXLa\nU+muWC2rkzENTloOfHIM4gw4DoVey9AoHSLWbg5b58791DZTmbmcbB9fm7PC\nTc04VKckJJ6lytW0U7oiciswZMw6wNKd7bdWKNaRP+9eZkiLvewlG5ZabIWx\njfW/DVpgb3ej25WlkW7EP7Tc8d9jr4pjsPds/mg40fbpdIGaf78LxlXv0g/p\nQKfaeYytMCyrwH9oENn44glgIFBBS8B/PUfc56vRUYmOwRIvrHsJuebEt4W4\nZpIbc71G/K0zeOcebt8UI0I5jY0GaahtZZYPQ0Kss1bxlZeAis59q1tSlGMr\nLY59KmTgfviZC/GXzfVz583k2sa7HwB1a37NX9FqH9rgRP15iMayZoiN5d0G\n9e3pgkjase6fyaFe9TPqV4xbHzASnyNvwLfrU34vMqQ9yWMO2LsN4kdiozch\nRpj3ygMIRPyH5zXNLP69rjvyhwmq20VQV+/tbreAJEZw0PhGevJVhogFIoU3\nw0iu\r\n=1ESm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCldcXP5ul9+GftJaO63xp4WXSeAe96JdNA/ZUbUimWUQIhAJqdlakNxvqSA2iRciDDPSF7rU97jgUTmxK11FkPWDwf"}]},"maintainers":[{"name":"josh-josh-miller","email":"wickedhillsmedia@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exceptions_0.0.2_1553623215498_0.40837021313304644"},"_hasShrinkwrap":false}},"time":{"created":"2019-03-26T06:14:47.851Z","0.0.1":"2019-03-26T06:14:48.185Z","modified":"2022-04-04T14:28:25.657Z","0.0.2":"2019-03-26T18:00:15.683Z"},"maintainers":[{"name":"josh-josh-miller","email":"wickedhillsmedia@gmail.com"}],"description":"Exceptions is an abstract class for creating custom exceptions. It contains functionality to tag additional information about context that ultimately led to an exception to be thrown in the first place. Errors in Javascript contains the “toString” method ","homepage":"https://github.com/ao-framework/exceptions#readme","repository":{"type":"git","url":"git+https://github.com/ao-framework/exceptions.git"},"bugs":{"url":"https://github.com/ao-framework/exceptions/issues"},"license":"ISC","readme":"<p align=\"center\">\r\n<img width=\"150\" src=\"https://ao-framework.github.io/website/ao.logo.svg\"><br>\r\n<b>Exceptions</b>\r\n</p>\r\n<p align=\"center\"><em>Currently in early development. Breaking changes will occur frequently.</em></p>\r\n\r\n**Exceptions** is an abstract class for creating custom exceptions. It contains functionality to tag additional information about context that ultimately led to an exception to be thrown in the first place. Errors in Javascript contains the “toString” method that usually contains the message, type and stack information from the Error. **Exceptions** contains two methods for viewing --“toString” and “toJson”. Both have their respected template methods to alter their view to the end user for a more detailed debugging experience.\r\n\r\nUsing custom exceptions is a controversial practice that is rife with arguments from well intended, opinionated and intelligent people. Understand the situation fully before use.\r\n\r\n\r\n#### Import the library\r\n```ts\r\nimport Exceptions from \"@ao-framework/exceptions\"\r\n```\r\n\r\n#### Create Custom Exceptions\r\n```ts\r\nexport class InvalidArgumentException extends Exception {}\r\nexport class BadInputException extends Exception {}\r\nexport class SystemException extends Exception {}\r\n```\r\n#### Basic Usage\r\n```ts\r\ntry {\r\n    let name = false;\r\n    if(typeof name !== \"string\") {\r\n        throw new BadInputException(\"name must be a string\", (exception) => {\r\n            exception.emergency(`name is equal to ${String(name)}`)\r\n            exception.alert(`name is equal to ${String(name)}`)\r\n            exception.critical(`name is equal to ${String(name)}`)\r\n            exception.error(`name is equal to ${String(name)}`)\r\n            exception.warning(`name is equal to ${String(name)}`)\r\n            exception.notice(`name is equal to ${String(name)}`)\r\n            exception.info(`name is equal to ${String(name)}`)\r\n            exception.debug(`name is equal to ${String(name)}`)\r\n            exception.tag(`custom-tag`, `name is equal to ${String(name)}`)\r\n        })\r\n    }\r\n} catch(err) {\r\n    if(err instanceof BadInputException) {\r\n        logger.errorSync(err.toJson())\r\n    } else {\r\n        throw err\r\n    }\r\n}\r\n```\r\n","readmeFilename":"README.md"}