@hashrytech/quick-components-kit 0.12.2 → 0.12.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @hashrytech/quick-components-kit
2
2
 
3
+ ## 0.12.4
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor: Not rethrowing request error
8
+
9
+ ## 0.12.3
10
+
11
+ ### Patch Changes
12
+
13
+ - fix: Display error message prop for text input
14
+
3
15
  ## 0.12.2
4
16
 
5
17
  ### Patch Changes
@@ -72,7 +72,7 @@
72
72
  {#if label}{@render label()}{:else}{#if labelText}<label for={id} class="text-sm font-medium text-neutral-600 ml-1">{labelText}</label>{/if}{/if}
73
73
  <div class="relative">
74
74
  {#if icon}<div class="absolute inset-y-0 left-0 flex items-center justify-center rounded-l-primary m-0.5 w-10">{@render icon()}</div>{/if}
75
- <input {disabled} {required} {type} {id} {name} {placeholder} {onchange} {onmouseup} bind:value
75
+ <input {disabled} {required} {type} {id} name={name ? name: id} {placeholder} {onchange} {onmouseup} bind:value
76
76
  class={twMerge("rounded-primary border-border-primary focus:border-primary-500 focus:ring-primary-500 placeholder:opacity-50 disabled:bg-neutral-300/30 disabled:border-gray-300/30",
77
77
  error ? "bg-red-50 border-red-300 ring-red-300" : "",
78
78
  icon ? "pl-10" : "",
@@ -80,6 +80,6 @@
80
80
  />
81
81
  </div>
82
82
  {#if error}
83
- <p class="text-sm text-red-500 mt-0.5 bg-red-100/30 px-2 rounded-primary">This is a an error message that is larger and bigger.</p>
83
+ <p class="text-sm text-red-500 mt-0.5 bg-red-100/30 px-2 rounded-primary">{error}</p>
84
84
  {/if}
85
85
  </div>
@@ -205,7 +205,7 @@ export class ApiClient {
205
205
  }
206
206
  // Re-throw the error if it hasn't been "handled" by a handler (e.g., by redirecting)
207
207
  // This ensures the calling context can still catch and react to the error.
208
- throw err;
208
+ //throw err; //Not rethrowing the error here, as we want to return ApiResponse with error details.
209
209
  }
210
210
  /**
211
211
  * Generic request method. All other HTTP methods call this.
@@ -230,8 +230,9 @@ export class ApiClient {
230
230
  }
231
231
  catch (error) {
232
232
  await this.handleError(error);
233
- const status = error instanceof ApiError ? error.status : 500;
234
- const message = error instanceof Error ? error.message : 'Unknown error';
233
+ const isApiError = error instanceof ApiError;
234
+ const status = isApiError ? error.status : 0; // 0 = network error or unknown
235
+ const message = error instanceof Error ? error.message : 'Unexpected error occurred';
235
236
  return {
236
237
  ok: false,
237
238
  status,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hashrytech/quick-components-kit.git"
7
7
  },
8
- "version": "0.12.2",
8
+ "version": "0.12.4",
9
9
  "license": "MIT",
10
10
  "author": "Hashry Tech",
11
11
  "files": [