Old missing file in wp-content/uploads/ returns a 500 error, how to catch and redirect?

Old missing file in wp-content/uploads/ returns a 500 error, how to catch and redirect?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)