From 4eab376f2bab8835a69e3d47d663c17d026f975a Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 16:23:15 -0800 Subject: [PATCH 01/12] Implement issue #1844 --- path/to/your/file1 | 1 + path/to/your/file2 | 1 + 2 files changed, 2 insertions(+) create mode 100644 path/to/your/file1 create mode 100644 path/to/your/file2 diff --git a/path/to/your/file1 b/path/to/your/file1 new file mode 100644 index 00000000000..5728ca8d443 --- /dev/null +++ b/path/to/your/file1 @@ -0,0 +1 @@ +Content of file 1 \ No newline at end of file diff --git a/path/to/your/file2 b/path/to/your/file2 new file mode 100644 index 00000000000..b0df1fb85cb --- /dev/null +++ b/path/to/your/file2 @@ -0,0 +1 @@ +Content of file 2 \ No newline at end of file From a0eb82989c0e07a3e84822eee7eeb553ae794522 Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 16:23:23 -0800 Subject: [PATCH 02/12] feat: implement granular try-catch in plugin-coinbase --- src/plugin-coinbase/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/plugin-coinbase/index.js diff --git a/src/plugin-coinbase/index.js b/src/plugin-coinbase/index.js new file mode 100644 index 00000000000..d862462ec0e --- /dev/null +++ b/src/plugin-coinbase/index.js @@ -0,0 +1,6 @@ +try { + // Code that may throw an error +} catch (error) { + console.error('Specific error message:', error); + // Handle specific error +} \ No newline at end of file From 49065e017b5c516b3a28754d01b3161e9070d8dd Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 16:35:55 -0800 Subject: [PATCH 03/12] Implement issue #1844 --- path/to/your/file1.js | 1 + path/to/your/file2.js | 1 + 2 files changed, 2 insertions(+) create mode 100644 path/to/your/file1.js create mode 100644 path/to/your/file2.js diff --git a/path/to/your/file1.js b/path/to/your/file1.js new file mode 100644 index 00000000000..bf19cfed294 --- /dev/null +++ b/path/to/your/file1.js @@ -0,0 +1 @@ +console.log('Implementing issue #1844'); \ No newline at end of file diff --git a/path/to/your/file2.js b/path/to/your/file2.js new file mode 100644 index 00000000000..209c0e2076b --- /dev/null +++ b/path/to/your/file2.js @@ -0,0 +1 @@ +function example() { return 'This is an example function'; } \ No newline at end of file From c9a1314324dbf8032bcd897eb6959e535f6941d6 Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 16:36:02 -0800 Subject: [PATCH 04/12] feat: implement granular error handling in plugin-coinbase --- src/plugin-coinbase/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin-coinbase/index.js b/src/plugin-coinbase/index.js index d862462ec0e..1b7050d9444 100644 --- a/src/plugin-coinbase/index.js +++ b/src/plugin-coinbase/index.js @@ -3,4 +3,4 @@ try { } catch (error) { console.error('Specific error message:', error); // Handle specific error -} \ No newline at end of file +} From 7e5089c9fd332be51d180afd01b86f4979625ca1 Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 16:52:32 -0800 Subject: [PATCH 05/12] Implement feature for issue #1844 --- packages/plugin-coinbase/example.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/plugin-coinbase/example.js diff --git a/packages/plugin-coinbase/example.js b/packages/plugin-coinbase/example.js new file mode 100644 index 00000000000..f7cbf7478bd --- /dev/null +++ b/packages/plugin-coinbase/example.js @@ -0,0 +1 @@ +// Example content for the new feature implementation for issue #1844 \ No newline at end of file From 0562fb4d13ff129d9f39252a56a015b98f939ac4 Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 16:53:08 -0800 Subject: [PATCH 06/12] feat: implement granular error handling in plugin-coinbase --- .../advanced-sdk-ts/src/rest/accounts.ts | 32 +++++++---- .../advanced-sdk-ts/src/rest/converts.ts | 53 ++++++++++++------- .../advanced-sdk-ts/src/rest/dataAPI.ts | 16 +++--- 3 files changed, 65 insertions(+), 36 deletions(-) diff --git a/packages/plugin-coinbase/advanced-sdk-ts/src/rest/accounts.ts b/packages/plugin-coinbase/advanced-sdk-ts/src/rest/accounts.ts index 04cec4b934d..0ff05efc5c3 100644 --- a/packages/plugin-coinbase/advanced-sdk-ts/src/rest/accounts.ts +++ b/packages/plugin-coinbase/advanced-sdk-ts/src/rest/accounts.ts @@ -14,11 +14,16 @@ export function getAccount( this: RESTBase, { accountUuid }: GetAccountRequest ): Promise { - return this.request({ - method: method.GET, - endpoint: `${API_PREFIX}/accounts/${accountUuid}`, - isPublic: false, - }); + try { + return this.request({ + method: method.GET, + endpoint: `${API_PREFIX}/accounts/${accountUuid}`, + isPublic: false, + }); + } catch (error) { + console.error('Error fetching account:', error); + throw error; + } } // [GET] List Accounts @@ -27,10 +32,15 @@ export function listAccounts( this: RESTBase, requestParams: ListAccountsRequest ): Promise { - return this.request({ - method: method.GET, - endpoint: `${API_PREFIX}/accounts`, - queryParams: requestParams, - isPublic: false, - }); + try { + return this.request({ + method: method.GET, + endpoint: `${API_PREFIX}/accounts`, + queryParams: requestParams, + isPublic: false, + }); + } catch (error) { + console.error('Error listing accounts:', error); + throw error; + } } diff --git a/packages/plugin-coinbase/advanced-sdk-ts/src/rest/converts.ts b/packages/plugin-coinbase/advanced-sdk-ts/src/rest/converts.ts index 435a807e285..670f63fc1a8 100644 --- a/packages/plugin-coinbase/advanced-sdk-ts/src/rest/converts.ts +++ b/packages/plugin-coinbase/advanced-sdk-ts/src/rest/converts.ts @@ -16,12 +16,17 @@ export function createConvertQuote( this: RESTBase, requestParams: CreateConvertQuoteRequest ): Promise { - return this.request({ - method: method.POST, - endpoint: `${API_PREFIX}/convert/quote`, - bodyParams: requestParams, - isPublic: false, - }); + try { + return this.request({ + method: method.POST, + endpoint: `${API_PREFIX}/convert/quote`, + bodyParams: requestParams, + isPublic: false, + }); + } catch (error) { + console.error('Error creating convert quote:', error); + throw error; + } } // [GET] Get Convert Trade @@ -30,24 +35,34 @@ export function getConvertTrade( this: RESTBase, { tradeId, ...requestParams }: GetConvertTradeRequest ): Promise { - return this.request({ - method: method.GET, - endpoint: `${API_PREFIX}/convert/trade/${tradeId}`, - queryParams: requestParams, - isPublic: false, - }); + try { + return this.request({ + method: method.GET, + endpoint: `${API_PREFIX}/convert/trade/${tradeId}`, + queryParams: requestParams, + isPublic: false, + }); + } catch (error) { + console.error('Error fetching convert trade:', error); + throw error; + } } -// [POST] Commit Connvert Trade +// [POST] Commit Convert Trade // https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_commitconverttrade export function commitConvertTrade( this: RESTBase, { tradeId, ...requestParams }: CommitConvertTradeRequest ): Promise { - return this.request({ - method: method.POST, - endpoint: `${API_PREFIX}/convert/trade/${tradeId}`, - bodyParams: requestParams, - isPublic: false, - }); + try { + return this.request({ + method: method.POST, + endpoint: `${API_PREFIX}/convert/trade/${tradeId}`, + bodyParams: requestParams, + isPublic: false, + }); + } catch (error) { + console.error('Error committing convert trade:', error); + throw error; + } } diff --git a/packages/plugin-coinbase/advanced-sdk-ts/src/rest/dataAPI.ts b/packages/plugin-coinbase/advanced-sdk-ts/src/rest/dataAPI.ts index 2adc6466076..ded686edbc7 100644 --- a/packages/plugin-coinbase/advanced-sdk-ts/src/rest/dataAPI.ts +++ b/packages/plugin-coinbase/advanced-sdk-ts/src/rest/dataAPI.ts @@ -1,6 +1,5 @@ import { API_PREFIX } from '../constants'; import { RESTBase } from './rest-base'; - import { method } from './types/request-types'; import { GetAPIKeyPermissionsResponse } from './types/dataAPI-types'; @@ -9,9 +8,14 @@ import { GetAPIKeyPermissionsResponse } from './types/dataAPI-types'; export function getAPIKeyPermissions( this: RESTBase ): Promise { - return this.request({ - method: method.GET, - endpoint: `${API_PREFIX}/key_permissions`, - isPublic: false, - }); + try { + return this.request({ + method: method.GET, + endpoint: `${API_PREFIX}/key_permissions`, + isPublic: false, + }); + } catch (error) { + console.error('Error fetching API Key Permissions:', error); + throw error; + } } From c0aa71bf532ec2e159d19879ec31f5ee56c00ec3 Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 17:01:20 -0800 Subject: [PATCH 07/12] Delete src/plugin-coinbase/index.js --- src/plugin-coinbase/index.js | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/plugin-coinbase/index.js diff --git a/src/plugin-coinbase/index.js b/src/plugin-coinbase/index.js deleted file mode 100644 index 1b7050d9444..00000000000 --- a/src/plugin-coinbase/index.js +++ /dev/null @@ -1,6 +0,0 @@ -try { - // Code that may throw an error -} catch (error) { - console.error('Specific error message:', error); - // Handle specific error -} From 170700297b0fbd80dbe29ba0cad1b086e153796c Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 17:01:56 -0800 Subject: [PATCH 08/12] Delete packages/plugin-coinbase/example.js --- packages/plugin-coinbase/example.js | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/plugin-coinbase/example.js diff --git a/packages/plugin-coinbase/example.js b/packages/plugin-coinbase/example.js deleted file mode 100644 index f7cbf7478bd..00000000000 --- a/packages/plugin-coinbase/example.js +++ /dev/null @@ -1 +0,0 @@ -// Example content for the new feature implementation for issue #1844 \ No newline at end of file From 763762ad1eca2aaf3c319ad03bfc59bc1fc1792a Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 17:03:21 -0800 Subject: [PATCH 09/12] Delete path/to/your/file2.js --- path/to/your/file2.js | 1 - 1 file changed, 1 deletion(-) delete mode 100644 path/to/your/file2.js diff --git a/path/to/your/file2.js b/path/to/your/file2.js deleted file mode 100644 index 209c0e2076b..00000000000 --- a/path/to/your/file2.js +++ /dev/null @@ -1 +0,0 @@ -function example() { return 'This is an example function'; } \ No newline at end of file From c3f24d1f54de6eb528c333212f0a97b7e5370e1b Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 17:03:34 -0800 Subject: [PATCH 10/12] Delete path/to/your/file1 --- path/to/your/file1 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 path/to/your/file1 diff --git a/path/to/your/file1 b/path/to/your/file1 deleted file mode 100644 index 5728ca8d443..00000000000 --- a/path/to/your/file1 +++ /dev/null @@ -1 +0,0 @@ -Content of file 1 \ No newline at end of file From 7a14ada0d061b8b501ca40b34e60677e93c92f0c Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 17:03:40 -0800 Subject: [PATCH 11/12] Delete path/to/your/file2 --- path/to/your/file2 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 path/to/your/file2 diff --git a/path/to/your/file2 b/path/to/your/file2 deleted file mode 100644 index b0df1fb85cb..00000000000 --- a/path/to/your/file2 +++ /dev/null @@ -1 +0,0 @@ -Content of file 2 \ No newline at end of file From d1c6da9c7e951bf9561c82e931fa6546eb628340 Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Sat, 4 Jan 2025 17:04:07 -0800 Subject: [PATCH 12/12] Delete path/to/your/file1.js --- path/to/your/file1.js | 1 - 1 file changed, 1 deletion(-) delete mode 100644 path/to/your/file1.js diff --git a/path/to/your/file1.js b/path/to/your/file1.js deleted file mode 100644 index bf19cfed294..00000000000 --- a/path/to/your/file1.js +++ /dev/null @@ -1 +0,0 @@ -console.log('Implementing issue #1844'); \ No newline at end of file