@mastra/deployer 1.0.0-beta.15 → 1.0.0-beta.16

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,45 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 1.0.0-beta.16
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `onError` hook to server configuration for custom error handling. ([#11403](https://github.com/mastra-ai/mastra/pull/11403))
8
+
9
+ You can now provide a custom error handler through the Mastra server config to catch errors, format responses, or send them to external services like Sentry:
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core/mastra';
13
+
14
+ const mastra = new Mastra({
15
+ server: {
16
+ onError: (err, c) => {
17
+ // Send to Sentry
18
+ Sentry.captureException(err);
19
+
20
+ // Return custom formatted response
21
+ return c.json(
22
+ {
23
+ error: err.message,
24
+ timestamp: new Date().toISOString(),
25
+ },
26
+ 500,
27
+ );
28
+ },
29
+ },
30
+ });
31
+ ```
32
+
33
+ If no `onError` is provided, the default error handler is used.
34
+
35
+ Fixes #9610
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [[`3d93a15`](https://github.com/mastra-ai/mastra/commit/3d93a15796b158c617461c8b98bede476ebb43e2), [`efe406a`](https://github.com/mastra-ai/mastra/commit/efe406a1353c24993280ebc2ed61dd9f65b84b26), [`119e5c6`](https://github.com/mastra-ai/mastra/commit/119e5c65008f3e5cfca954eefc2eb85e3bf40da4), [`0ff9edd`](https://github.com/mastra-ai/mastra/commit/0ff9edda410f5eadb6e73f5cadc4bf82a51c3bce), [`74e504a`](https://github.com/mastra-ai/mastra/commit/74e504a3b584eafd2f198001c6a113bbec589fd3), [`e33fdbd`](https://github.com/mastra-ai/mastra/commit/e33fdbd07b33920d81e823122331b0c0bee0bb59), [`929f69c`](https://github.com/mastra-ai/mastra/commit/929f69c3436fa20dd0f0e2f7ebe8270bd82a1529), [`8a73529`](https://github.com/mastra-ai/mastra/commit/8a73529ca01187f604b1f3019d0a725ac63ae55f)]:
40
+ - @mastra/core@1.0.0-beta.16
41
+ - @mastra/server@1.0.0-beta.16
42
+
3
43
  ## 1.0.0-beta.15
4
44
 
5
45
  ### Patch Changes
@@ -3675,7 +3675,13 @@ async function createHonoServer(mastra, options = {
3675
3675
  customRouteAuthConfig.set(routeKey, requiresAuth);
3676
3676
  }
3677
3677
  }
3678
- app.onError((err, c) => errorHandler(err, c, options.isDev));
3678
+ const customOnError = server?.onError;
3679
+ app.onError((err, c) => {
3680
+ if (customOnError) {
3681
+ return customOnError(err, c);
3682
+ }
3683
+ return errorHandler(err, c, options.isDev);
3684
+ });
3679
3685
  const bodyLimitOptions = {
3680
3686
  maxSize: server?.bodySizeLimit ?? 4.5 * 1024 * 1024,
3681
3687
  // 4.5 MB,