@serverless/sdk
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -5,2 +5,14 @@ # Changelog | ||
### [0.4.4](https://github.com/serverless/console/compare/@serverless/sdk@0.4.3...@serverless/sdk@0.4.4) (2023-02-01) | ||
### Bug Fixes | ||
- Do not define `undefined` properties in structured error ([37e2491](https://github.com/serverless/console/commit/37e2491b9c0baa8ea606db1d1e595bccbb9e6d8a)) | ||
- Ensure to unpack structured SDK errors for captured events ([b0ecd2b](https://github.com/serverless/console/commit/b0ecd2ba17eb6cb4b238b6518f7c1f0c882b2be1)) | ||
### Maintenance Improvements | ||
- Improve stack trace presentation in SDK error ([40c3930](https://github.com/serverless/console/commit/40c3930796b8783bfbc565df9182d7f2c977138a)) | ||
- Report stack trace with simpler `stack` property ([a6f4604](https://github.com/serverless/console/commit/a6f46040e987524616f79088f90107df274224e5)) | ||
### [0.4.3](https://github.com/serverless/console/compare/@serverless/sdk@0.4.2...@serverless/sdk@0.4.3) (2023-01-30) | ||
@@ -7,0 +19,0 @@ |
@@ -26,6 +26,6 @@ 'use strict'; | ||
} else { | ||
tags.name = resolveNonErrorName(error); | ||
tags.name = options._name || resolveNonErrorName(error); | ||
tags.message = typeof error === 'string' ? error : util.inspect(error); | ||
} | ||
tags.stacktrace = resolveStackTraceString(error); | ||
tags.stacktrace = options._stack || resolveStackTraceString(error); | ||
capturedEvent.tags.setMany(tags, { prefix: 'error' }); | ||
@@ -32,0 +32,0 @@ |
@@ -36,6 +36,15 @@ 'use strict'; | ||
try { | ||
createErrorCapturedEvent( | ||
args.length === 1 && isError(args[0]) ? args[0] : resolveMessage(args), | ||
{ _origin: 'nodeConsole' } | ||
); | ||
const input = args[0]; | ||
if (args.length === 1 && isPlainObject(input) && input.source === 'serverlessSdk') { | ||
createErrorCapturedEvent(input.message, { | ||
_name: input.name, | ||
_stack: input.stack, | ||
_origin: 'nodeConsole', | ||
}); | ||
} else { | ||
createErrorCapturedEvent( | ||
args.length === 1 && isError(input) ? input : resolveMessage(args), | ||
{ _origin: 'nodeConsole' } | ||
); | ||
} | ||
} catch (error) { | ||
@@ -42,0 +51,0 @@ reportSdkError(error); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const resolveNonErrorName = require('./resolve-non-error-name'); | ||
const resolveStackTraceString = require('./resolve-stack-trace-string'); | ||
@@ -20,15 +21,14 @@ module.exports = (error, options = {}) => { | ||
const type = options.type || 'INTERNAL'; | ||
console.error({ | ||
source: 'serverlessSdk', | ||
type, | ||
description: | ||
type === 'INTERNAL' | ||
? 'Internal Serverless SDK Error. ' + | ||
'Please report at https://github.com/serverless/console/issue' | ||
: undefined, | ||
name, | ||
message, | ||
code: error && error.code, | ||
stackTrace: error && error.stack, | ||
}); | ||
const errorData = { source: 'serverlessSdk', type }; | ||
if (type === 'INTERNAL') { | ||
errorData.description = | ||
'Internal Serverless SDK Error. ' + | ||
'Please report at https://github.com/serverless/console/issue'; | ||
} | ||
errorData.name = name; | ||
errorData.message = message; | ||
if (error.code) errorData.code = error.code; | ||
if (error.stack) errorData.stack = resolveStackTraceString(error); | ||
console.error(errorData); | ||
}; |
{ | ||
"name": "@serverless/sdk", | ||
"repository": "serverless/console", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"author": "Serverless, Inc.", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65631
1294