* Parse the PDF document.
()
| 157 | * Parse the PDF document. |
| 158 | */ |
| 159 | parse(): ParsedDocument { |
| 160 | try { |
| 161 | return this.parseNormal(); |
| 162 | } catch (error) { |
| 163 | // Only attempt recovery for recoverable parsing errors |
| 164 | if (this.options.lenient && error instanceof RecoverableParseError) { |
| 165 | this.warnings.push(`Normal parsing failed: ${error.message}`); |
| 166 | |
| 167 | return this.parseWithRecovery(); |
| 168 | } |
| 169 | |
| 170 | // All other errors propagate (credentials, unsupported features, etc.) |
| 171 | throw error; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Normal parsing path. |
no test coverage detected