Skip to content

Commit

Permalink
Improve exception messages in ffi integration
Browse files Browse the repository at this point in the history
  • Loading branch information
vkhramtsov committed Jan 19, 2021
1 parent 60883c4 commit 091e14c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Bicycle/Tesseract/Bridge/FFI.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function __construct(Configuration $configuration)
try {
$libaryPath = $this->configuration->getSharedLibraryPath();
if (empty($libaryPath)) {
throw new Exception\Exception('Problem with connecting library via FFI');
throw new Exception\Exception('Problem with connecting library via FFI: empty library path');
}
/** @var FFI\TesseractInterface ffiInstance */
$this->ffiInstance = \FFI::cdef(
$definitions,
$libaryPath
);
} catch (\FFI\Exception $e) {
throw new Exception\Exception('Problem with connecting library via FFI');
throw new Exception\Exception(sprintf('Problem with connecting library via FFI: %s', $e->getMessage()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Bicycle/Tesseract/Bridge/FFITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testIncorrectConfiguration(): void
{
$this->isFFIEnabled();
$this->expectException(Exception::class);
$this->expectExceptionMessage('Problem with connecting library via FFI');
$this->expectExceptionMessage('Problem with connecting library via FFI: empty library path');
$configuration = new Configuration([]);
new FFI($configuration);
}
Expand Down

0 comments on commit 091e14c

Please sign in to comment.