File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -107,9 +107,14 @@ export default class BindingSimulator implements IClientSimulatorImpl {
107107 private getProductColor ( id : number , partnerId : number ) {
108108 // one and only one of the agents should have a product color
109109 // so the order here is not important
110- return (
111- this . productColor . get ( partnerId ) || this . productColor . get ( id ) || ""
112- ) ;
110+ const color1 = this . productColor . get ( id ) ;
111+ const color2 = this . productColor . get ( partnerId ) ;
112+ if ( color1 && color2 ) {
113+ throw new Error (
114+ `Both agents (${ id } and ${ partnerId } ) have a product color defined. Only one should have a product color.`
115+ ) ;
116+ }
117+ return color2 || color1 || "" ;
113118 }
114119
115120 private getRandomPoint ( ) {
You can’t perform that action at this time.
0 commit comments