diff --git a/src/AnnotationReader.php b/src/AnnotationReader.php index 285225e..c1fd360 100644 --- a/src/AnnotationReader.php +++ b/src/AnnotationReader.php @@ -40,11 +40,16 @@ class AnnotationReader if ( $reflect->getAttributes() ) { foreach($reflect->getAttributes() as $attr) { - $tags[] = [ - 'tag' => substr(strrchr($attr->getName(), "\\"), 1), - 'arguments' => $attr->getArguments(), - 'object' => $attr->newInstance(), - ]; + try { + $tags[] = [ + 'tag' => substr(strrchr($attr->getName(), "\\"), 1), + 'arguments' => $attr->getArguments(), + 'object' => $attr->newInstance(), + ]; + } + catch(\Throwable $e) { + throw new \Exception(sprintf("%s for %s in file '%s'", $e->getMessage(), $reflect, $this->class)); + } } } else {