1
0
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:
orklah 2022-01-01 01:19:13 +01:00 committed by GitHub
commit 8dc1a31e11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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([]);
}