From 426b6173c6f7d027e270be205bada6e73876f204 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Fri, 8 Mar 2013 14:15:22 -0400 Subject: [PATCH] Better handling of error if the sort column cannot be found in model classes db fields --- code/forms/GridFieldSortableRows.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/forms/GridFieldSortableRows.php b/code/forms/GridFieldSortableRows.php index ad13c90..25f347c 100644 --- a/code/forms/GridFieldSortableRows.php +++ b/code/forms/GridFieldSortableRows.php @@ -134,7 +134,12 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP $sng=singleton($gridField->getModelClass()); $fieldType=$sng->db($this->sortColumn); if(!$fieldType || !($fieldType=='Int' || is_subclass_of('Int', $fieldType))) { - user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType, E_USER_ERROR); + if(is_array($fieldType)) { + user_error('Sort column '.$this->sortColumn.' could not be found in '.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR); + }else { + user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType, E_USER_ERROR); + } + exit; } }