forked from marcpabst/PdfiumLight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPdfException.cs
More file actions
58 lines (50 loc) · 1.57 KB
/
PdfException.cs
File metadata and controls
58 lines (50 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Runtime.Serialization;
#pragma warning disable 1591
namespace PdfiumLight
{
public class PdfException : Exception
{
public PdfError Error { get; private set; }
public PdfException()
{
}
public PdfException(PdfError error)
: this(GetMessage(error))
{
Error = error;
}
private static string GetMessage(PdfError error)
{
switch (error)
{
case PdfError.Success:
return "No error";
case PdfError.CannotOpenFile:
return "File not found or could not be opened";
case PdfError.InvalidFormat:
return "File not in PDF format or corrupted";
case PdfError.PasswordProtected:
return "Password required or incorrect password";
case PdfError.UnsupportedSecurityScheme:
return "Unsupported security scheme";
case PdfError.PageNotFound:
return "Page not found or content error";
default:
return "Unknown error";
}
}
public PdfException(string message)
: base(message)
{
}
public PdfException(string message, Exception innerException)
: base(message, innerException)
{
}
protected PdfException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}