private static string GetMessage(FPDF_ERR error) { switch (error) { case FPDF_ERR.SUCCESS: return("[0] Success."); case FPDF_ERR.FILE: return("[2] File access error, which means file cannot be found or be opened."); case FPDF_ERR.FORMAT: return("[3] Data format error."); case FPDF_ERR.PASSWORD: return("[4] Incorrect password error."); case FPDF_ERR.SECURITY: return("[5] Unsupported security scheme error."); case FPDF_ERR.INVALIDLICENSE: return("[6] License authorization error."); case FPDF_ERR.UNKNOWN: default: return("[1] Unknown error."); } }
public static string GetDescription(this FPDF_ERR error) { switch (error) { case FPDF_ERR.SUCCESS: return("No error."); case FPDF_ERR.UNKNOWN: return("Unkown error."); case FPDF_ERR.FILE: return("File not found or could not be opened."); case FPDF_ERR.FORMAT: return("File not in PDF format or corrupted."); case FPDF_ERR.PASSWORD: return("Password required or incorrect password."); case FPDF_ERR.SECURITY: return("Unsupported security scheme."); case FPDF_ERR.PAGE: return("Page not found or content error."); case FPDF_ERR.XFALOAD: return("Load XFA error."); case FPDF_ERR.XFALAYOUT: return("Layout XFA error."); default: return($"{error} (No description available)."); } }
public PdfException(FPDF_ERR error) : this(GetMessage(error)) { Error = error; }