Skip to content

Commit

Permalink
format errors correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyaschorge committed Nov 18, 2024
1 parent f05fee5 commit 343768d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ build

.DS_Store

test-sdk.ts
test-sdk.ts
test-sdk.js
8 changes: 6 additions & 2 deletions scripts/generate-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,12 @@ export class ${clientClassName} {
if (typeof config === 'string') {
console.error('Error: config must be of type Configuration');
console.log('Correct usage:');
console.log(\`
Seems, like you are using sdk v2 but the syntax on client instantiation is for sdk v1.
SDK v1 -> v2 migration guide: https://docs.neynar.com/reference/neynar-nodejs-sdk-v1-to-v2-migration-guide
Correct usage way to instantiate the client:
import { ${clientClassName}, Configuration } from "@neynar/nodejs-sdk";
const config = new Configuration({
Expand All @@ -768,7 +772,7 @@ const config = new Configuration({
},
});
const client = new ${clientClassName}(config);\`);
const client = new ${clientClassName}(config);\\n\`);
throw new Error('Invalid configuration type. Expected Configuration object but received string.');
}
Expand Down
8 changes: 6 additions & 2 deletions src/clients/NeynarAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ export class NeynarAPIClient {

if (typeof config === 'string') {
console.error('Error: config must be of type Configuration');
console.log('Correct usage:');
console.log(`
Seems, like you are using sdk v2 but the syntax on client instantiation is for sdk v1.
SDK v1 -> v2 migration guide: https://docs.neynar.com/reference/neynar-nodejs-sdk-v1-to-v2-migration-guide
Correct usage way to instantiate the client:
import { NeynarAPIClient, Configuration } from "@neynar/nodejs-sdk";
const config = new Configuration({
Expand All @@ -119,7 +123,7 @@ const config = new Configuration({
},
});
const client = new NeynarAPIClient(config);`);
const client = new NeynarAPIClient(config);\n`);
throw new Error('Invalid configuration type. Expected Configuration object but received string.');
}

Expand Down
8 changes: 6 additions & 2 deletions src/clients/NeynarHubClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ export class NeynarHubClient {

if (typeof config === 'string') {
console.error('Error: config must be of type Configuration');
console.log('Correct usage:');
console.log(`
Seems, like you are using sdk v2 but the syntax on client instantiation is for sdk v1.
SDK v1 -> v2 migration guide: https://docs.neynar.com/reference/neynar-nodejs-sdk-v1-to-v2-migration-guide
Correct usage way to instantiate the client:
import { NeynarHubClient, Configuration } from "@neynar/nodejs-sdk";
const config = new Configuration({
Expand All @@ -107,7 +111,7 @@ const config = new Configuration({
},
});
const client = new NeynarHubClient(config);`);
const client = new NeynarHubClient(config);\n`);
throw new Error('Invalid configuration type. Expected Configuration object but received string.');
}

Expand Down

0 comments on commit 343768d

Please sign in to comment.