Generate better errors in base.php