mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Merge pull request #7247 from tm1000/bugfix/7246
Fixes #7246, wrap getTypeContextAtPosition in try/catch
This commit is contained in:
commit
8dc1a31e11
@ -276,11 +276,16 @@ class TextDocument
|
||||
return new Success([]);
|
||||
}
|
||||
|
||||
$type_context = $this->codebase->getTypeContextAtPosition($file_path, $position);
|
||||
try {
|
||||
$type_context = $this->codebase->getTypeContextAtPosition($file_path, $position);
|
||||
} catch (UnexpectedValueException $e) {
|
||||
error_log('completion errored at ' . $position->line . ':' . $position->character.
|
||||
', Reason: '.$e->getMessage());
|
||||
return new Success([]);
|
||||
}
|
||||
|
||||
if (!$completion_data && !$type_context) {
|
||||
error_log('completion not found at ' . $position->line . ':' . $position->character);
|
||||
|
||||
return new Success([]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user