Aristarkh Zagorodnikov avatar Aristarkh Zagorodnikov committed bc6809c

More error kinds are auto-retried
Improved error logging
Minor cleanups

Comments (0)

Files changed (1)

gridfs/mod_gridfs.cpp

 					connection->done();
 					return HTTP_NOT_MODIFIED;
 				}
-				mongo::gridfs_offset file_length = gridfile.getContentLength();
+				const mongo::gridfs_offset file_length = gridfile.getContentLength();
 				content_length = 0;
 				content_type = gridfile.getContentType();
 				if (file_length != 0 && request->header_only == 0)
 				const int code = exception.getCode();
 				switch (code)
 				{
+				case 10009:	//	ReplicaSetMonitor no master found for set
 				case 10276:	//	DBClientBase::findN: transport error
-					ap_log_rerror(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, result, request, "mod_gridfs: Retrying user exception for file '%s': %s (code: %i).", filename, exception.what(), code); 
+				case 11002:	//	socket exception
+					ap_log_rerror(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, result, request, "mod_gridfs: Retrying user exception for file '%s' (code: %d): %s.", filename, code, exception.what()); 
 					break;
 
 				default:
 			apr_table_setn(request->headers_out, "Expires", expires);
 		}
 	}
+	catch (const mongo::DBException& exception)
+	{
+		ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, request, "mod_gridfs: MongoDB exception occured for file '%s' (code: %d): %s.", filename, exception.getCode(), exception.what()); 
+		if (brigade != 0)
+			apr_brigade_destroy(brigade);
+		return HTTP_INTERNAL_SERVER_ERROR;
+	}
 	catch (const std::exception& exception)
 	{
 		ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, request, "mod_gridfs: Handler exception occured for file '%s': %s.", filename, exception.what()); 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.