File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -533,6 +533,12 @@ DiscoveryV1.prototype.addDocument = function(params, callback) {
533
533
* @return {ReadableStream|undefined }
534
534
*/
535
535
DiscoveryV1 . prototype . addJsonDocument = function ( params , callback ) {
536
+ const fileParamType = typeof params . file ;
537
+
538
+ if ( fileParamType !== 'object' ) {
539
+ throw new Error ( `Argument error: params.file must be an object, but got ${ fileParamType } .` ) ;
540
+ }
541
+
536
542
params = Object . assign ( { } , params , {
537
543
file : {
538
544
value : JSON . stringify ( params . file ) ,
@@ -557,6 +563,12 @@ DiscoveryV1.prototype.addJsonDocument = function(params, callback) {
557
563
* @return {ReadableStream|undefined }
558
564
*/
559
565
DiscoveryV1 . prototype . updateJsonDocument = function ( params , callback ) {
566
+ const fileParamType = typeof params . file ;
567
+
568
+ if ( fileParamType !== 'object' ) {
569
+ throw new Error ( `Argument error: params.file must be an object, but got ${ fileParamType } .` ) ;
570
+ }
571
+
560
572
params = Object . assign ( { } , params , {
561
573
file : {
562
574
value : JSON . stringify ( params . file ) ,
You can’t perform that action at this time.
0 commit comments