Custom post type change excerpt more and excerpt length

you made it complex a bit i used this simple lines of code;

add_filter('excerpt_length', function ($length) {
    global $post;
    if ($post->post_type == 'portfolio'){
        return 13;
    }
    return 50;
}, 100);

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