Skip to content

Commit 020e4f2

Browse files
committed
Better exception
1 parent f605d1b commit 020e4f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Response/Result/Hit.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getStringValue(string $key): string
8888
return $this->source[$key];
8989
}
9090

91-
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException('Value is not string.');
91+
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException(\sprintf('Value for key %s is not string.', $key));
9292
}
9393

9494

@@ -112,7 +112,7 @@ public function getArrayValue(string $key): array
112112
return $this->source[$key];
113113
}
114114

115-
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException('Value is not array.');
115+
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException(\sprintf('Value for key %s is not array.', $key));
116116
}
117117

118118

@@ -136,7 +136,7 @@ public function getBoolValue(string $key): bool
136136
return $this->source[$key];
137137
}
138138

139-
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException('Value is not bool.');
139+
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException(\sprintf('Value for key %s is not bool.', $key));
140140
}
141141

142142

@@ -160,7 +160,7 @@ public function getIntegerValue(string $key): int
160160
return $this->source[$key];
161161
}
162162

163-
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException('Value is not integer.');
163+
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException(\sprintf('Value for key %s is not integer.', $key));
164164
}
165165

166166

0 commit comments

Comments
 (0)