I think you missed , at the of after_title that’s why it’s not working. Use this code it’s working fine.
register_sidebar( array(
'name' => 'Custom code widget',
'id' => 'custom-code',
'description' => 'Cutom code for all pages.',
'before_widget' => '<div class="custom-description">',
'after_widget' => '</div>',
'before_title' => '<div class="custom-code-title"><h2 class="widget-title">',
'after_title' => '</h2></div>',
) );