@serverless/sdk
Advanced tools
Comparing version 0.5.25 to 0.5.26
@@ -5,2 +5,8 @@ # Changelog | ||
### [0.5.26](https://github.com/serverless/console/compare/@serverless/sdk@0.5.25...@serverless/sdk@0.5.26) (2023-09-27) | ||
### Bug Fixes | ||
- Report SDK user error for invalid span name ([#879](https://github.com/serverless/console/issues/879)) ([73b091d](https://github.com/serverless/console/commit/73b091d6eead7ecec1b8591c129cc942667613f2)) | ||
### [0.5.25](https://github.com/serverless/console/compare/@serverless/sdk@0.5.24...@serverless/sdk@0.5.25) (2023-08-16) | ||
@@ -7,0 +13,0 @@ |
35
index.js
@@ -68,4 +68,14 @@ 'use strict'; | ||
serverlessSdk.createSpan = (name, closure) => { | ||
const span = serverlessSdk._createTraceSpan(name); | ||
let span; | ||
try { | ||
span = serverlessSdk._createTraceSpan(name); | ||
} catch (error) { | ||
try { | ||
reportError(error, { type: 'USER' }); | ||
} catch (err) { | ||
// ignore | ||
} | ||
} | ||
if (closure && isFunction(closure)) { | ||
@@ -76,3 +86,5 @@ let result; | ||
} catch (e) { | ||
span.close(); | ||
if (span) { | ||
span.close(); | ||
} | ||
throw e; | ||
@@ -83,7 +95,11 @@ } | ||
(resolution) => { | ||
span.close(); | ||
if (span) { | ||
span.close(); | ||
} | ||
return resolution; | ||
}, | ||
(error) => { | ||
span.close(); | ||
if (span) { | ||
span.close(); | ||
} | ||
throw error; | ||
@@ -93,6 +109,13 @@ } | ||
} | ||
span.close(); | ||
if (span) { | ||
span.close(); | ||
} | ||
return result; | ||
} | ||
return span; | ||
if (span) { | ||
return span; | ||
} | ||
return { close: () => {} }; | ||
}; | ||
@@ -99,0 +122,0 @@ |
{ | ||
"name": "@serverless/sdk", | ||
"repository": "serverless/console", | ||
"version": "0.5.25", | ||
"version": "0.5.26", | ||
"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
92329
1754