[Rprotobuf-commits] r582 - in pkg: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 19 08:23:34 CET 2013


Author: murray
Date: 2013-12-19 08:23:33 +0100 (Thu, 19 Dec 2013)
New Revision: 582

Modified:
   pkg/ChangeLog
   pkg/R/wrapper_EnumDescriptor.R
Log:
Add better error handling.



Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2013-12-19 06:59:56 UTC (rev 581)
+++ pkg/ChangeLog	2013-12-19 07:23:33 UTC (rev 582)
@@ -6,6 +6,9 @@
 	* R/00classes.R (P): Ensure that the FileDescriptor $name() method
 	  accepts a boolean for full paths just like the generic name()
 	  method.
+	* R/wrapper_EnumDescriptor.R: Add better error checking.  Expect
+	  exceptions if wrong types are provided for arguments rather than
+	  just returning NULL.
 
 2013-12-18  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/R/wrapper_EnumDescriptor.R
===================================================================
--- pkg/R/wrapper_EnumDescriptor.R	2013-12-19 06:59:56 UTC (rev 581)
+++ pkg/R/wrapper_EnumDescriptor.R	2013-12-19 07:23:33 UTC (rev 582)
@@ -21,14 +21,17 @@
 	}
 	
 	if( has_index ){
+		stopifnot(is.numeric(index))
 		return( .Call( "EnumDescriptor__getValueByIndex", object at pointer, as.integer(index)-1L, PACKAGE = "RProtoBuf" ) )
 	}
 	
 	if( has_number ){
+		stopifnot(is.numeric(number))
 		return( .Call( "EnumDescriptor__getValueByNumber", object at pointer, as.integer(number), PACKAGE = "RProtoBuf" ) )
 	}
 	
 	if( has_name ){
+		stopifnot(is.character(name))
 		return( .Call( "EnumDescriptor__getValueByName", object at pointer, as.character(name), PACKAGE = "RProtoBuf" ) )
 	}
 	



More information about the Rprotobuf-commits mailing list