File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
components/google_drive/common Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
1
import fs from "fs" ;
2
- import { axios } from "@pipedream/platform" ;
2
+ import {
3
+ axios , ConfigurationError ,
4
+ } from "@pipedream/platform" ;
3
5
import {
4
6
MY_DRIVE_VALUE ,
5
7
LEGACY_MY_DRIVE_VALUE ,
@@ -266,9 +268,16 @@ function optionalParseAsJSON(value) {
266
268
}
267
269
268
270
function parseObjectEntries ( value = { } ) {
269
- const obj = typeof value === "string"
270
- ? JSON . parse ( value )
271
- : value ;
271
+ let obj ;
272
+ if ( typeof value === "string" ) {
273
+ try {
274
+ obj = JSON . parse ( value ) ;
275
+ } catch ( e ) {
276
+ throw new ConfigurationError ( `Invalid JSON string provided: ${ e . message } ` ) ;
277
+ }
278
+ } else {
279
+ obj = value ;
280
+ }
272
281
return Object . fromEntries (
273
282
Object . entries ( obj ) . map ( ( [
274
283
key ,
You can’t perform that action at this time.
0 commit comments