Can you change a setting in php.ini for display_errors=On temporary to get error details.
OR
You can change config_override.php to set logger level as $sugar_config['logger']['level'] = 'debug'; and check your logs file (public/legacy/suitecrm.log) to debug the issue.
Mon Dec 16 12:07:29 2024 [3349256][1][DEBUG] Hook called: AOS_Contracts::before_save
Mon Dec 16 12:07:29 2024 [3349256][1][DEBUG] Including Ext hook file for custom/modules/AOS_Contracts
Mon Dec 16 12:07:29 2024 [3349256][1][DEBUG] Creating new instance of hook class AOS_Contracts without parameters
Mon Dec 16 12:07:29 2024 [3349256][1][DEBUG] Hook called: ::server_round_trip
Mon Dec 16 12:07:29 2024 [3349256][1][DEBUG] Calling MySQLi::disconnect()
If the code you shared is the complete file you also have to take in count that the function should be contained within a class and then the class has to be specified on the logic_hooks.php file. You can look examples here: Logic Hooks :: SuiteCRM Documentation
you should not use the class name AOS_Contracts because it is the default name of the Contracts bean class. please use something like ContractsLogickHooks