| | | 1 | | namespace ZhEaIsNsAaBn.Utilities.PrintPDF; |
| | | 2 | | |
| | | 3 | | /// <summary>Errors returned by <see cref="ChromiumHandler"/>. Type: <c>PrintPdfError</c>.</summary> |
| | | 4 | | public static class PrintPdfErrors |
| | | 5 | | { |
| | | 6 | | private const string PrintPdfError = nameof( PrintPdfError ); |
| | | 7 | | |
| | | 8 | | |
| | | 9 | | /// <summary>Chromium couldn't be downloaded or started.</summary> |
| | | 10 | | /// <param name="exception">The exception, kept for logs.</param> |
| | | 11 | | /// <returns>The <c>BrowserNotStarted</c> error (severity High).</returns> |
| | | 12 | | public static Error BrowserNotStarted( Exception exception ) |
| | 10 | 13 | | => new( nameof( BrowserNotStarted ), PrintPdfError, "تعذر تشغيل المتصفح لطباعة الملف.", "The browser for printin |
| | | 14 | | |
| | | 15 | | /// <summary>The URL isn't <c>http</c>/<c>https</c>, or its host isn't in <see cref="ChromiumOptions.AllowedHosts"/> |
| | | 16 | | /// <param name="url">The refused URL; only its scheme and host are kept (in additional data).</param> |
| | | 17 | | /// <returns>The <c>UrlNotAllowed</c> error (severity High).</returns> |
| | | 18 | | public static Error UrlNotAllowed( Uri url ) |
| | | 19 | | { |
| | 14 | 20 | | ArgumentNullException.ThrowIfNull( url ); |
| | | 21 | | |
| | 14 | 22 | | return new Error( nameof( UrlNotAllowed ), PrintPdfError, "عنوان الصفحة غير مسموح بطباعته.", "This address isn't |
| | 14 | 23 | | new Dictionary<string, object> { [ "Scheme" ] = url.Scheme, [ "Host" ] = url.IsAbsoluteUri ? u |
| | | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary>The page couldn't be loaded or printed.</summary> |
| | | 27 | | /// <param name="exception">The exception, kept for logs.</param> |
| | | 28 | | /// <returns>The <c>PrintFailed</c> error (severity Medium).</returns> |
| | | 29 | | public static Error PrintFailed( Exception exception ) |
| | 0 | 30 | | => new( nameof( PrintFailed ), PrintPdfError, "تعذرت طباعة الملف بصيغة PDF.", "The PDF couldn't be printed.", Se |
| | | 31 | | } |