Skip to content

Commit

Permalink
fix: correct error output
Browse files Browse the repository at this point in the history
  • Loading branch information
kauffinger committed Dec 16, 2024
1 parent 3795c56 commit 357c7c2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Markitdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function convert(string $filename): string
->run();

if (! $processResult->successful()) {
throw MarkitdownException::processFailed('markitdown', $processResult->output());
throw MarkitdownException::processFailed('markitdown', $processResult->errorOutput());
}

return $processResult->output();
Expand All @@ -44,7 +44,7 @@ public function convertString(string $content): string
->run();

if (! $processResult->successful()) {
throw MarkitdownException::processFailed('markitdown', $processResult->output());
throw MarkitdownException::processFailed('markitdown', $processResult->errorOutput());
}

return $processResult->output();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Take Notes

* To take notes, just tap here and start typing.
* Or, easily create a digital notebook for all your notes that automatically syncs across your devices, using the free OneNote app.

## To learn more and get OneNote, visit [www.onenote.com](http://go.microsoft.com/fwlink/?LinkID=523891).


5 changes: 5 additions & 0 deletions tests/MarkitdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

declare(strict_types=1);

use Innobrain\Markitdown\Exceptions\MarkitdownException;
use Innobrain\Markitdown\Facades\Markitdown;

it('can execute markitdown', function (): void {
Expand All @@ -21,3 +22,7 @@

expect($conv)->toMatchSnapshot();
});

it('throws exception with error output when process fails', function (): void {
Markitdown::convert('non_existent_file.docx');
})->throws(MarkitdownException::class, 'The command `markitdown` failed with output: Traceback (most recent call last):');

0 comments on commit 357c7c2

Please sign in to comment.