Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Unified Diff: samples/pdfium_test.cc

Issue 1413923006: Add context to file load failures in pdfium_test. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 66dd3f2f1bc461e807e98b610ae03656c081e434..6e5b8d9f22a63ebca8112352d5fa2612785a5f96 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -390,7 +390,35 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len,
}
if (!doc) {
- fprintf(stderr, "Load pdf docs unsuccessful.\n");
+ unsigned long err = FPDF_GetLastError();
+ fprintf(stderr, "Load pdf docs unsuccessful: ");
+ switch (err) {
+ case FPDF_ERR_SUCCESS:
+ fprintf(stderr, "Success");
+ break;
+ case FPDF_ERR_UNKNOWN:
+ fprintf(stderr, "Unknown error");
+ break;
+ case FPDF_ERR_FILE:
+ fprintf(stderr, "File not found or could not be opened");
+ break;
+ case FPDF_ERR_FORMAT:
+ fprintf(stderr, "File not in PDF format or corrupted");
+ break;
+ case FPDF_ERR_PASSWORD:
+ fprintf(stderr, "Password required or incorrect password");
+ break;
+ case FPDF_ERR_SECURITY:
+ fprintf(stderr, "Unsupported security scheme");
+ break;
+ case FPDF_ERR_PAGE:
+ fprintf(stderr, "Page not found or content error");
+ break;
+ default:
+ fprintf(stderr, "Unknown error %ld\n", err);
Tom Sepez 2015/10/27 16:25:36 nit: \n not needed here.
dsinclair 2015/10/27 17:02:33 Done.
+ }
+ fprintf(stderr, ".\n");
+
FPDFAvail_Destroy(pdf_avail);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698