From a6a678d8ed9c17fc12c6de677a4d0a0ec4a6319d Mon Sep 17 00:00:00 2001 From: Jacob Shufro Date: Wed, 15 Jun 2022 23:16:10 +0000 Subject: [PATCH] Enforce bpg action fields argument type is an object/dict Summary: If you pass a string, no error is throw, and no action is taken, causing a bit of confusion for users (such as cts) refs T21563 Test Plan: npm linked to test manually Reviewers: sbahra, jpihlaja, ahicks Reviewed By: jpihlaja, ahicks Maniphest Tasks: T21563 Differential Revision: https://hack.in.backtrace.io/D5369 --- lib/bpg.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bpg.js b/lib/bpg.js index 45ba520..3da5514 100644 --- a/lib/bpg.js +++ b/lib/bpg.js @@ -226,6 +226,8 @@ class BPG { throw Error('unknown action'); } + if (typeof fields != 'object') + throw Error('fields must be a dict') /* * Construct key object from parent, otherwise construct from * child.