Add comprehensive installation and setup documentation

- Add GETTING_STARTED.md with quick start guide and development modes
- Add INSTALL.sh automated installation script
- Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md
- Add QUICK_REFERENCE.md for common commands
- Add SETUP_GUIDE.md with detailed setup instructions
- Update README.md with improved project overview
- Add did-wallet app dependencies and node_modules
This commit is contained in:
Dorian
2026-01-27 17:18:21 +00:00
parent a81f655133
commit 0d073fa89e
22658 changed files with 4494151 additions and 6 deletions
+33
View File
@@ -0,0 +1,33 @@
# Layerr Changelog
## v2.1.0
_2024-04-18_
* Error assertion via `assertError`
## v2.0.1
_2023-07-17_
* React-Native entry in `package.json`
## v2.0.0
_2023-02-13_
* ESM
## v1.0.0
_2022-12-12_
* **Major release**
* Class-based `Layerr` instance, compiled to function-style during build
## v0.1.2
_2020-08-29_
* **Bugfix**:
* Arguments not specified in constructor for `Layerr`
## v0.1.0
_2020-08-27_
* Initial release
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Perry Mitchell
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.
+49
View File
@@ -0,0 +1,49 @@
# Layerr
> Errors, with.. layers..
A NodeJS and Web `Error` wrapping utility, based heavily on [VError](https://github.com/joyent/node-verror), but without all the extras and dependencies on Node core utilities. Written in Typescript, compiled to JavaScript and suitable for bundling in the browser.
Uses no dependencies, minifies well and is a great way to wrap errors as they propagate through complex applications (such as Express services, for instance).
_Layerr is an ESM library, and as such you need a compatible environment in which to install and use it._
## Installation
Install by running: `npm install layerr`.
## Usage
Use it as a regular error:
```javascript
const { Layerr } = require("layerr");
throw new Layerr("Test error");
```
Or use it to wrap errors:
```javascript
doSomething().catch(err => {
throw new Layerr(err, "Failed doing something");
});
```
Layerr's can have info attached:
```javascript
const { Layerr } = require("layerr");
function somethingElse() {
throw new Layerr({
info: {
code: 123
}
}, "Problem");
}
somethingElse().catch((err: Layerr) => {
const { code } = Layerr.info(err);
// code === 123
});
```
+2
View File
@@ -0,0 +1,2 @@
export declare function assertError(err: unknown): asserts err is Error;
export declare function isError(err: unknown): boolean;
+11
View File
@@ -0,0 +1,11 @@
export function assertError(err) {
if (!isError(err)) {
throw new Error("Parameter was not an error");
}
}
export function isError(err) {
return objectToString(err) === "[object Error]" || err instanceof Error;
}
function objectToString(obj) {
return Object.prototype.toString.call(obj);
}
+3
View File
@@ -0,0 +1,3 @@
export { Layerr } from "./layerr.js";
export { assertError, isError } from "./error.js";
export * from "./types.js";
+3
View File
@@ -0,0 +1,3 @@
export { Layerr } from "./layerr.js";
export { assertError, isError } from "./error.js";
export * from "./types.js";
+11
View File
@@ -0,0 +1,11 @@
import { LayerrInfo, LayerrOptions } from "./types.js";
export declare class Layerr extends Error {
_cause?: Error;
_info?: LayerrInfo;
constructor(errorOptionsOrMessage?: LayerrOptions | string | Error, messageText?: string);
static cause(err: Layerr | Error): Layerr | Error | null;
static fullStack(err: Layerr | Error): string;
static info(err: Layerr | Error): LayerrInfo;
cause(): Error | Layerr | null;
toString(): string;
}
+67
View File
@@ -0,0 +1,67 @@
import { assertError, isError } from "./error.js";
import { parseArguments } from "./tools.js";
export class Layerr extends Error {
constructor(errorOptionsOrMessage, messageText) {
const args = [...arguments];
const { options, shortMessage } = parseArguments(args);
let message = shortMessage;
if (options.cause) {
message = `${message}: ${options.cause.message}`;
}
super(message);
this.message = message;
if (options.name && typeof options.name === "string") {
this.name = options.name;
}
else {
this.name = "Layerr";
}
if (options.cause) {
Object.defineProperty(this, "_cause", { value: options.cause });
}
Object.defineProperty(this, "_info", { value: {} });
if (options.info && typeof options.info === "object") {
Object.assign(this._info, options.info);
}
if (Error.captureStackTrace) {
const ctor = options.constructorOpt || this.constructor;
Error.captureStackTrace(this, ctor);
}
}
static cause(err) {
assertError(err);
if (!err._cause)
return null;
return isError(err._cause) ? err._cause : null;
}
static fullStack(err) {
assertError(err);
const cause = Layerr.cause(err);
if (cause) {
return `${err.stack}\ncaused by: ${Layerr.fullStack(cause)}`;
}
return err.stack;
}
static info(err) {
assertError(err);
const output = {};
const cause = Layerr.cause(err);
if (cause) {
Object.assign(output, Layerr.info(cause));
}
if (err._info) {
Object.assign(output, err._info);
}
return output;
}
cause() {
return Layerr.cause(this);
}
toString() {
let output = this.name || this.constructor.name || this.constructor.prototype.name;
if (this.message) {
output = `${output}: ${this.message}`;
}
return output;
}
}
+5
View File
@@ -0,0 +1,5 @@
import { LayerrOptions } from "./types.js";
export declare function parseArguments(args: Array<any>): {
options: LayerrOptions;
shortMessage: string;
};
+28
View File
@@ -0,0 +1,28 @@
import { isError } from "./error.js";
export function parseArguments(args) {
let options, shortMessage = "";
if (args.length === 0) {
options = {};
}
else if (isError(args[0])) {
options = {
cause: args[0]
};
shortMessage = args.slice(1).join(" ") || "";
}
else if (args[0] && typeof args[0] === "object") {
options = Object.assign({}, args[0]);
shortMessage = args.slice(1).join(" ") || "";
}
else if (typeof args[0] === "string") {
options = {};
shortMessage = shortMessage = args.join(" ") || "";
}
else {
throw new Error("Invalid arguments passed to Layerr");
}
return {
options,
shortMessage
};
}
+9
View File
@@ -0,0 +1,9 @@
export interface LayerrInfo {
[key: string]: any;
}
export interface LayerrOptions {
name?: string;
cause?: Error;
info?: Object;
constructorOpt?: Function;
}
+1
View File
@@ -0,0 +1 @@
export {};
+57
View File
@@ -0,0 +1,57 @@
{
"name": "layerr",
"version": "2.1.0",
"description": "Error wrapping utility for NodeJS and the browser",
"exports": "./dist/index.js",
"react-native": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"scripts": {
"build": "run-s clean && tsc",
"clean": "rimraf ./dist",
"dev": "npm run clean && tsc --watch",
"prepublishOnly": "npm run build",
"test": "run-s build test:specs",
"test:specs": "nyc mocha 'test/**/*.spec.js'"
},
"files": [
"dist/**/*.js",
"dist/**/*.d.ts",
"*.md"
],
"repository": {
"type": "git",
"url": "git+https://github.com/perry-mitchell/layerr.git"
},
"keywords": [
"error",
"verror",
"err",
"nerror",
"exception",
"wrapper",
"extend"
],
"author": "Perry Mitchell <perry@perrymitchell.net>",
"license": "MIT",
"bugs": {
"url": "https://github.com/perry-mitchell/layerr/issues"
},
"homepage": "https://github.com/perry-mitchell/layerr#readme",
"devDependencies": {
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@types/node": "^18.11.10",
"babel-loader": "^9.1.0",
"chai": "^4.3.7",
"mocha": "^10.1.0",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"resolve-typescript-plugin": "^2.0.0",
"rimraf": "^3.0.2",
"typescript": "^4.9.3",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
}
}