mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
🐛 Fix display of errors for rocket.chat
This commit is contained in:
parent
e0859ae0e2
commit
e09a4b91ad
|
@ -29,14 +29,13 @@ export async function rocketchatApiRequest(this: IHookFunctions | IExecuteFuncti
|
|||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
let errorMessage = error.message;
|
||||
|
||||
const errorMessage = error.response.body.message || error.response.body.Message;
|
||||
|
||||
if (errorMessage !== undefined) {
|
||||
throw errorMessage;
|
||||
if (error.response.body.error) {
|
||||
errorMessage = error.response.body.error;
|
||||
}
|
||||
throw error.response.body;
|
||||
|
||||
throw new Error(`Rocket.chat error response [${error.statusCode}]: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue