Skip to content

Commit e0df1a0

Browse files
committed
Improved exception message to include problematic class
1 parent 8662e58 commit e0df1a0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Types/MutableTrait.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public function addFields(callable $fields): void
5050
public function getField($name): FieldDefinition
5151
{
5252
if ($this->status === MutableInterface::STATUS_PENDING) {
53-
throw new RuntimeException('You must freeze() a MutableObjectType before fetching its fields.');
53+
throw new RuntimeException(
54+
'You must freeze() the MutableObjectType, ' . $this->className . ', before fetching its fields.',
55+
);
5456
}
5557

5658
return parent::getField($name);
@@ -64,7 +66,9 @@ public function getField($name): FieldDefinition
6466
public function hasField($name): bool
6567
{
6668
if ($this->status === MutableInterface::STATUS_PENDING) {
67-
throw new RuntimeException('You must freeze() a MutableObjectType before fetching its fields.');
69+
throw new RuntimeException(
70+
'You must freeze() the MutableObjectType, ' . $this->className . ', before fetching its fields.',
71+
);
6872
}
6973

7074
return parent::hasField($name);
@@ -79,7 +83,9 @@ public function getFields(): array
7983
{
8084
if ($this->finalFields === null) {
8185
if ($this->status === MutableInterface::STATUS_PENDING) {
82-
throw new RuntimeException('You must freeze() a MutableObjectType before fetching its fields.');
86+
throw new RuntimeException(
87+
'You must freeze() the MutableObjectType, ' . $this->className . ', before fetching its fields.',
88+
);
8389
}
8490

8591
$this->finalFields = parent::getFields();

0 commit comments

Comments
 (0)