Skip to content

Commit

Permalink
fix #71: Throw a better TypeError in osc message creators
Browse files Browse the repository at this point in the history
  • Loading branch information
crucialfelix committed Dec 6, 2019
1 parent ae7ec71 commit 3d9bf35
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/server/src/osc/msg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ function flattenPairs(pairs: PairsType): OscType[] {
if (_.isArray(pairs)) {
return _.flatten(pairs);
}
// unreachable
throw new Error(`Unmatched type: ${pairs}`);
throw new TypeError(
`Received ${typeof pairs} ${JSON.stringify(pairs)}. Expected \{key: value, ...\} or [[key, value],...]`,
);
}

/**
Expand Down

0 comments on commit 3d9bf35

Please sign in to comment.