diff --git a/README.md b/README.md
index c6f2ea7..be77ff4 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@

πTutorials |
@@ -35,9 +35,9 @@ What you get:
// Instead
let data;
try {
- data = readFile("...path");
+ data = readFile("...path");
} catch {
- throw Error("Cant Load File!");
+ throw Error("Cant Load File!");
}
// Do
@@ -116,11 +116,11 @@ Processes an error object, invoking functions with provided arguments
```ts
const MyErrorList = {
- BLACKLISTED: {
- name: "Black Listed Name",
- hint: "Try use other one!",
- message: (name: string) => `${name} is on black list!`,
- },
+ BLACKLISTED: {
+ name: "Black Listed Name",
+ hint: "Try use other one!",
+ message: (name: string) => `${name} is on black list!`
+ }
} as const satisfies TMyErrorList;
throw new myError(MyErrorList.BLACKLISTED, { message: ["nameInputed"] });
@@ -164,10 +164,7 @@ const data = myErrorWrapper(readFile,err => new Error(`ERROR MESSAGE: ${err.mess
> At async function it returns Promise, just use `await` to solve that
```ts
-const data = await myErrorWrapper(
- asyncFun,
- new Error("Oh, Error!")
-)("MyString");
+const data = await myErrorWrapper(asyncFun, new Error("Oh, Error!"))("MyString");
```
### myErrorCatcher
@@ -176,8 +173,8 @@ const data = await myErrorWrapper(
```ts
const data = await myErrorCatcher(readFile)("path...").catch(() => {
- // Code before crash...
- throw new Error("Can't read file!");
+ // Code before crash...
+ throw new Error("Can't read file!");
});
```
@@ -189,10 +186,10 @@ Execute Scenarios for an error!
const [data, isError] = myErrorWrapper(readFile)("./ReadThisFile");
const MyErrorHandlerList = {
- FS001: () => {
- // Do this code if throw this error
- console.error("ERROR");
- },
+ FS001: () => {
+ // Do this code if throw this error
+ console.error("ERROR");
+ }
};
if (isError) myErrorHandler(data.code, MyErrorHandlerList)();
```
@@ -211,24 +208,24 @@ if (isError) myErrorHandler(data.code, MyErrorHandlerList)();
```ts
const ErrorList = {
- notFound: {
- name: "Not Found",
- code: "FS001",
- message: {
- user: "File not found",
- dev: "The file you are trying to read does not exist",
- },
- hint: (path: string) => `Check if the file exists at ${path}`,
- } satisfies IMyError,
- cantRead: {
- code: "FS002",
- name: "Cant Read",
- message: { user: "Can't read file", dev: "readFileSync throw error" },
- hint: {
- user: "Check if the file is not corrupted or permissions",
- dev: "File is corrupted or has no permissions to be read",
- },
- },
+ notFound: {
+ name: "Not Found",
+ code: "FS001",
+ message: {
+ user: "File not found",
+ dev: "The file you are trying to read does not exist"
+ },
+ hint: (path: string) => `Check if the file exists at ${path}`
+ } satisfies IMyError,
+ cantRead: {
+ code: "FS002",
+ name: "Cant Read",
+ message: { user: "Can't read file", dev: "readFileSync throw error" },
+ hint: {
+ user: "Check if the file is not corrupted or permissions",
+ dev: "File is corrupted or has no permissions to be read"
+ }
+ }
} as const satisfies TMyErrorList;
```
diff --git a/packages/oh-my-error/package.json b/packages/oh-my-error/package.json
index 84d8554..beb22be 100644
--- a/packages/oh-my-error/package.json
+++ b/packages/oh-my-error/package.json
@@ -69,5 +69,8 @@
"packageManager": "pnpm@9.4.0",
"engines": {
"node": ">=20"
+ },
+ "publishConfig": {
+ "access": "public"
}
}