LCOV - code coverage report
Current view: top level - src - pdf_exception.dart Coverage Total Hit
Test: lcov.info Lines: 100.0 % 3 3
Test Date: 2026-08-24 04:28:45 Functions: - 0 0

            Line data    Source code
       1              : // Copyright 2026 The Authors.
       2              : //
       3              : // Licensed under the Apache License, Version 2.0 (the "License");
       4              : // you may not use this file except in compliance with the License.
       5              : // You may obtain a copy of the License at
       6              : //
       7              : //     https://www.apache.org/licenses/LICENSE-2.0
       8              : //
       9              : // Unless required by applicable law or agreed to in writing, software
      10              : // distributed under the License is distributed on an "AS IS" BASIS,
      11              : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12              : // See the License for the specific language governing permissions and
      13              : // limitations under the License.
      14              : 
      15              : /// A general-purpose exception thrown when an unexpected PDFium native
      16              : /// failure occurs.
      17              : ///
      18              : /// [PdfiumException] is thrown when a PDFium FFI call returns a failure that
      19              : /// cannot be attributed to a known, recoverable condition (such as an invalid
      20              : /// document or a missing password). For example, if `FPDFBitmap_Create`
      21              : /// returns `null` unexpectedly — indicating a native allocation failure — a
      22              : /// [PdfiumException] is thrown with a descriptive [message].
      23              : ///
      24              : /// Known, recoverable conditions (password-required, corrupt document) use
      25              : /// [PdfError] and [PdfExtractionException] instead.
      26              : ///
      27              : /// ## Example
      28              : ///
      29              : /// ```dart
      30              : /// try {
      31              : ///   final image = await doc.renderPage(0, 800, 600);
      32              : /// } on PdfiumException catch (e) {
      33              : ///   print('PDFium native failure: ${e.message}');
      34              : /// }
      35              : /// ```
      36              : class PdfiumException implements Exception {
      37              :   /// Creates a [PdfiumException] with the given [message].
      38            2 :   const PdfiumException(this.message);
      39              : 
      40              :   /// A human-readable description of why the PDFium call failed.
      41              :   final String message;
      42              : 
      43            1 :   @override
      44            2 :   String toString() => 'PdfiumException: $message';
      45              : }
        

Generated by: LCOV version 2.0-1