@@ -106,6 +106,7 @@ function custom_field_allow_manage_display( $p_type, $p_display ) {
106
106
* @param bool $p_trigger_errors indicates whether to trigger an error if the field is not found
107
107
* @return array array representing custom field
108
108
* @access public
109
+ * @throws MantisBT\Exception\CustomField\FieldNotFound
109
110
*/
110
111
function custom_field_cache_row ( $ p_field_id , $ p_trigger_errors = true ) {
111
112
global $ g_cache_custom_field , $ g_cache_name_to_id_map ;
@@ -121,7 +122,7 @@ function custom_field_cache_row( $p_field_id, $p_trigger_errors = true ) {
121
122
122
123
if ( !$ t_row ) {
123
124
if ( $ p_trigger_errors ) {
124
- throw new MantisBT \Exception \Custom_Field_Not_Found ( 'Custom ' . $ p_field_id );
125
+ throw new MantisBT \Exception \CustomField \ FieldNotFound ( 'Custom ' . $ p_field_id );
125
126
} else {
126
127
return false ;
127
128
}
@@ -411,6 +412,8 @@ function custom_field_create( $p_name ) {
411
412
* @return bool
412
413
* @access public
413
414
* @throws MantisBT\Exception\Field\EmptyField
415
+ * @throws MantisBT\Exception\CustomField\NameNotUnique
416
+ * @throws MantisBT\Exception\CustomField\InvalidDefinition
414
417
*/
415
418
function custom_field_update ( $ p_field_id , $ p_def_array ) {
416
419
$ c_field_id = (int )$ p_field_id ;
@@ -438,11 +441,11 @@ function custom_field_update( $p_field_id, $p_def_array ) {
438
441
}
439
442
440
443
if (( $ c_access_level_rw < $ c_access_level_r ) || ( $ c_length_min < 0 ) || (( $ c_length_max != 0 ) && ( $ c_length_min > $ c_length_max ) ) ) {
441
- throw new MantisBT \Exception \Custom_Field_Invalid_Definition ();
444
+ throw new MantisBT \Exception \CustomField \ InvalidDefinition ();
442
445
}
443
446
444
447
if ( !custom_field_is_name_unique ( $ c_name , $ c_field_id ) ) {
445
- throw new MantisBT \Exception \Custom_Field_Name_Not_Unique ();
448
+ throw new MantisBT \Exception \CustomField \ NameNotUnique ();
446
449
}
447
450
448
451
$ t_update_something = false ;
@@ -619,11 +622,9 @@ function custom_field_update( $p_field_id, $p_def_array ) {
619
622
custom_field_clear_cache ( $ p_field_id );
620
623
} else {
621
624
return false ;
622
-
623
625
# there is nothing to update...
624
626
}
625
627
626
- # db_query errors on failure so:
627
628
return true ;
628
629
}
629
630
@@ -1319,6 +1320,7 @@ function custom_field_set_sequence( $p_field_id, $p_project_id, $p_sequence ) {
1319
1320
* @param array $p_field_def custom field definition
1320
1321
* @param int $p_bug_id bug id
1321
1322
* @access public
1323
+ * @throws MantisBT\Exception\CustomField\InvalidDefinition
1322
1324
*/
1323
1325
function print_custom_field_input ( $ p_field_def , $ p_bug_id = null ) {
1324
1326
if ( null === $ p_bug_id ) {
@@ -1339,7 +1341,7 @@ function print_custom_field_input( $p_field_def, $p_bug_id = null ) {
1339
1341
if ( isset ( $ g_custom_field_type_definition [$ p_field_def ['type ' ]]['#function_print_input ' ] ) ) {
1340
1342
call_user_func ( $ g_custom_field_type_definition [$ p_field_def ['type ' ]]['#function_print_input ' ], $ p_field_def , $ t_custom_field_value );
1341
1343
} else {
1342
- throw new MantisBT \Exception \Custom_Field_Invalid_Definition ();
1344
+ throw new MantisBT \Exception \CustomField \ InvalidDefinition ();
1343
1345
}
1344
1346
}
1345
1347
0 commit comments