@gugananuvem/aws-local-simulator 1.0.28 → 1.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gugananuvem/aws-local-simulator",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Simulador local completo para serviços AWS",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -66,6 +66,6 @@
66
66
  "publishConfig": {
67
67
  "directory": "dist"
68
68
  },
69
- "buildDate": "2026-04-30T14:28:21.971Z",
69
+ "buildDate": "2026-04-30T19:05:54.245Z",
70
70
  "published": true
71
71
  }
@@ -77,8 +77,14 @@ class CognitoSimulator {
77
77
  return null;
78
78
  }
79
79
 
80
- const result = await this.lambdaSimulator.invoke(fnName, event, "RequestResponse");
81
- return result.Payload;
80
+ try {
81
+ const result = await this.lambdaSimulator.invoke(fnName, event, "RequestResponse");
82
+ return result.Payload;
83
+ } catch (error) {
84
+ const wrappedError = new Error(error.message);
85
+ wrappedError.code = "UserLambdaValidationException";
86
+ throw wrappedError;
87
+ }
82
88
  }
83
89
 
84
90
  async initialize() {
@@ -112,7 +112,13 @@ class LambdaSimulator {
112
112
  return { StatusCode: 202 };
113
113
  }
114
114
 
115
- const result = await this.executeHandler(lambda.handler, event);
115
+ let result;
116
+ try {
117
+ result = await this.executeHandler(lambda.handler, event);
118
+ } catch (error) {
119
+ logger.error(`❌ Lambda handler error (${functionName}):`, error);
120
+ throw error;
121
+ }
116
122
  this.audit.record({
117
123
  eventName: "Invoke",
118
124
  readOnly: false,
@@ -123,17 +129,9 @@ class LambdaSimulator {
123
129
  }
124
130
 
125
131
  async executeHandler(handler, event) {
126
- try {
127
- const context = this.createContext();
128
- const result = await handler(event, context);
129
- return result;
130
- } catch (error) {
131
- logger.error("❌ Erro no handler:", error);
132
- return {
133
- statusCode: 500,
134
- body: JSON.stringify({ error: "Internal Server Error", message: error.message }),
135
- };
136
- }
132
+ const context = this.createContext();
133
+ const result = await handler(event, context);
134
+ return result;
137
135
  }
138
136
 
139
137
  createContext() {