mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
🎨 Centralize error throwing for encryption keys and credentials (#3105)
* Centralized error throwing for encryption key * Unifying the error message used by cli and core packages * Improvements to error messages to make it more DRY * Removed unnecessary throw * Throwing error when credential does not exist to simplify node behavior (#3112) Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
|
||||
export async function strapiApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const credentials = await this.getCredentials('strapiApi') as IDataObject;
|
||||
const credentials = await this.getCredentials('strapiApi');
|
||||
|
||||
try {
|
||||
const options: OptionsWithUri = {
|
||||
@@ -44,7 +44,7 @@ export async function strapiApiRequest(this: IExecuteFunctions | ILoadOptionsFun
|
||||
}
|
||||
|
||||
export async function getToken(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = await this.getCredentials('strapiApi') as IDataObject;
|
||||
const credentials = await this.getCredentials('strapiApi');
|
||||
let options = {} as OptionsWithUri;
|
||||
options = {
|
||||
headers: {
|
||||
@@ -64,7 +64,7 @@ export async function getToken(this: IExecuteFunctions | ILoadOptionsFunctions |
|
||||
export async function strapiApiRequestAllItems(this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, headers: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
const {apiVersion} = await this.getCredentials('strapiApi') as IDataObject;
|
||||
const {apiVersion} = await this.getCredentials('strapiApi');
|
||||
|
||||
let responseData;
|
||||
if (apiVersion === 'v4') {
|
||||
|
||||
Reference in New Issue
Block a user