assertion failed => break into debugger

How can I customize customizeErrorHandler() so it breaks into the debugger automatically?

Do you mean so that your debugger will automatically break when custoimzeErrorHandler is called? You can do this by adding a break point on customizeErrorHandler ‘b customizeErrorHandler’. If you want it done automatically, try adding the break command to the end of your debug script.