Fix n8n always in success mode

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-03 11:05:48 +01:00
parent 9bbea1d15e
commit 06098464b0

View File

@@ -34,7 +34,19 @@ export async function proboApiRequest(
};
try {
return await this.helpers.httpRequest(options);
const response = await this.helpers.httpRequest(options);
if (response.errors && Array.isArray(response.errors) && response.errors.length > 0) {
const errorMessages = response.errors.map((err: IDataObject) =>
err.message || JSON.stringify(err)
).join('; ');
throw new NodeApiError(this.getNode(), {
message: `GraphQL errors: ${errorMessages}`,
httpCode: '200',
} as JsonObject);
}
return response;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}