better-call 1.0.7 → 1.0.9

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/dist/node.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { j as Router } from './router-mvPUuWw_.cjs';
2
+ import { j as Router } from './router-Bn_wF2y_.cjs';
3
3
 
4
4
  declare function getRequest({ request, base, bodySizeLimit, }: {
5
5
  base: string;
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { j as Router } from './router-mvPUuWw_.js';
2
+ import { j as Router } from './router-Bn_wF2y_.js';
3
3
 
4
4
  declare function getRequest({ request, base, bodySizeLimit, }: {
5
5
  base: string;
@@ -788,6 +788,13 @@ interface EndpointOptions {
788
788
  * List of middlewares to use
789
789
  */
790
790
  use?: Middleware[];
791
+ /**
792
+ * A callback to run before any API error is throw or returned
793
+ *
794
+ * @param e - The API error
795
+ * @returns - The response to return
796
+ */
797
+ onAPIError?: (e: APIError) => void | Promise<void>;
791
798
  }
792
799
  type EndpointContext<Path extends string, Options extends EndpointOptions, Context = {}> = {
793
800
  /**
@@ -788,6 +788,13 @@ interface EndpointOptions {
788
788
  * List of middlewares to use
789
789
  */
790
790
  use?: Middleware[];
791
+ /**
792
+ * A callback to run before any API error is throw or returned
793
+ *
794
+ * @param e - The API error
795
+ * @returns - The response to return
796
+ */
797
+ onAPIError?: (e: APIError) => void | Promise<void>;
791
798
  }
792
799
  type EndpointContext<Path extends string, Options extends EndpointOptions, Context = {}> = {
793
800
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-call",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "type-fest": "^4.23.0",
21
21
  "typescript": "^5.6.0-beta",
22
22
  "valibot": "1.0.0-beta.15",
23
- "vitest": "^3.0.3",
23
+ "vitest": "^3.1.1",
24
24
  "zod": "^3.24.1"
25
25
  },
26
26
  "dependencies": {