fix(Nextcloud Node): Throw an actual error if server responded with Fatal error (#8234)

## Summary
Nextcloud and Yourls receiving response with OK status as string
containing 'Fatal error', throw an actual error in such case

![image](https://github.com/n8n-io/n8n/assets/88898367/7cba4b8c-3b34-476f-8a35-e10738022427)

## Related tickets and issues

https://linear.app/n8n/issue/NODE-1035/nextcloud-and-yourls-throw-an-actual-error-if-server-responded-with
This commit is contained in:
Michael Kret
2024-01-05 12:13:29 +02:00
committed by GitHub
parent 6e78d2346e
commit b201ff8f23
3 changed files with 2412 additions and 2 deletions

View File

@@ -37,6 +37,16 @@ export async function yourlsApiRequest(
);
}
if (typeof response === 'string' && response.includes('<b>Fatal error</b>')) {
throw new NodeOperationError(
this.getNode(),
"Yourls responded with a 'Fatal error', check description for more details",
{
description: `Server response:\n${response}`,
},
);
}
return response;
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);