mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 02:51:14 +00:00
fix(workflow): remove a few ts-ignore and eslint-disable (#3958)
fix(workflow): remove a few `ts-ignore` and `eslint-disable`. improve typing
This commit is contained in:
committed by
GitHub
parent
712924cbc3
commit
a73ac1d94f
@@ -76,9 +76,8 @@ export abstract class ExecutionBaseError extends Error {
|
||||
this.message = error.message as string;
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(error, 'context')) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this.context = (error as any).context;
|
||||
if (error instanceof ExecutionBaseError) {
|
||||
this.context = error.context;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,14 +129,12 @@ abstract class NodeError extends ExecutionBaseError {
|
||||
): string | null {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const key of potentialKeys) {
|
||||
if (error[key]) {
|
||||
if (typeof error[key] === 'string') return error[key] as string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
if (typeof error[key] === 'number') return error[key]!.toString();
|
||||
if (Array.isArray(error[key])) {
|
||||
// @ts-ignore
|
||||
const resolvedErrors: string[] = error[key]
|
||||
// @ts-ignore
|
||||
const value = error[key];
|
||||
if (value) {
|
||||
if (typeof value === 'string') return value;
|
||||
if (typeof value === 'number') return value.toString();
|
||||
if (Array.isArray(value)) {
|
||||
const resolvedErrors: string[] = value
|
||||
.map((error) => {
|
||||
if (typeof error === 'string') return error;
|
||||
if (typeof error === 'number') return error.toString();
|
||||
@@ -146,15 +143,15 @@ abstract class NodeError extends ExecutionBaseError {
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((errorValue: string | null) => errorValue !== null);
|
||||
.filter((errorValue): errorValue is string => errorValue !== null);
|
||||
|
||||
if (resolvedErrors.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return resolvedErrors.join(' | ');
|
||||
}
|
||||
if (this.isTraversableObject(error[key])) {
|
||||
const property = this.findProperty(error[key] as JsonObject, potentialKeys);
|
||||
if (this.isTraversableObject(value)) {
|
||||
const property = this.findProperty(value, potentialKeys);
|
||||
if (property) {
|
||||
return property;
|
||||
}
|
||||
@@ -164,8 +161,9 @@ abstract class NodeError extends ExecutionBaseError {
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const key of traversalKeys) {
|
||||
if (this.isTraversableObject(error[key])) {
|
||||
const property = this.findProperty(error[key] as JsonObject, potentialKeys, traversalKeys);
|
||||
const value = error[key];
|
||||
if (this.isTraversableObject(value)) {
|
||||
const property = this.findProperty(value, potentialKeys, traversalKeys);
|
||||
if (property) {
|
||||
return property;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user