mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(AWS DynamoDB Node): Add missing type assertion (no-changelog) (#5003)
fix(AWS DynamoDB Node): add type assertion
This commit is contained in:
@@ -18,7 +18,7 @@ export * from './WorkflowErrors';
|
||||
export * from './WorkflowHooks';
|
||||
export * from './VersionedNodeType';
|
||||
export { LoggerProxy, NodeHelpers, ObservableObject, TelemetryHelpers };
|
||||
export { deepCopy, jsonParse, sleep, fileTypeFromMimeType } from './utils';
|
||||
export { deepCopy, jsonParse, sleep, fileTypeFromMimeType, assert } from './utils';
|
||||
export {
|
||||
isINodeProperties,
|
||||
isINodePropertyOptions,
|
||||
|
||||
@@ -74,3 +74,21 @@ export function fileTypeFromMimeType(mimeType: string): BinaryFileType | undefin
|
||||
if (mimeType.startsWith('text/')) return 'text';
|
||||
return;
|
||||
}
|
||||
|
||||
export function assert<T>(condition: T, msg?: string): asserts condition {
|
||||
if (!condition) {
|
||||
const error = new Error(msg ?? 'Invalid assertion');
|
||||
// hide assert stack frame if supported
|
||||
if (Error.hasOwnProperty('captureStackTrace')) {
|
||||
// V8 only - https://nodejs.org/api/errors.html#errors_error_capturestacktrace_targetobject_constructoropt
|
||||
Error.captureStackTrace(error, assert);
|
||||
} else if (error.stack) {
|
||||
// fallback for IE and Firefox
|
||||
error.stack = error.stack
|
||||
.split('\n')
|
||||
.slice(1) // skip assert function from stack frames
|
||||
.join('\n');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user