lenix 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -28,9 +28,6 @@ bun i lenix
28
28
  yarn add lenix
29
29
  ```
30
30
 
31
- ## 📚 Documentation
32
- unavailable
33
-
34
31
  ## GitHub
35
32
  [![](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/lenixdev/lenix)
36
33
 
@@ -0,0 +1 @@
1
+ export declare const safeRequest: (domain: string, endpoint: string, request: RequestInit) => Promise<Response>;
@@ -0,0 +1,11 @@
1
+ export const safeRequest = async (domain, endpoint, request) => {
2
+ try {
3
+ return await fetch(`https://${domain}/${endpoint}`, request);
4
+ }
5
+ catch (error) {
6
+ throw new Error('An error occurred while making the request.', { cause: error });
7
+ }
8
+ finally {
9
+ console.log(`End of ${domain}${endpoint} request`);
10
+ }
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lenix",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Helpful modules for the software engineers",
5
5
  "author": "Lenix",
6
6
  "license": "GPL-3.0",