Else statement is not running (Javascript)

document.querySelector('#subbut').addEventListener('click',e => {
            e.preventDefault();

            const errbox = document.querySelector('.errbox');
            let errs = 0;
            const errmsgs = [];

            errbox.innerHTML = '';

            const fields = {
                _csrf : '<%= csrfToken %>', 
                name : document.querySelector('#name').value,
                username : document.querySelector('#username').value.trim(), 
                email : document.querySelector('#email').value.trim(), 
                password : document.querySelector('#password').value, 
                confirmPassword : document.querySelector('#confirmPassword').value
            }


            // if(!validator.isEmail(fields.email)){

            //     errs++;
            //     errmsgs.push('Please enter a valid email.');

            // }

            // if(fields.password.length < 6){
            //     errs++;
            //     errmsgs.push('Password must be at least 6 characters');

            // }

            // if(fields.password !== fields.confirmPassword){

            //     errs++;
            //     errmsgs.push('Confirm Password does not match.');

            // }

            // if(errs){
            //     for(msg of errmsgs){

            //         errbox.insertAdjacentHTML('beforeend','<p>'+ msg +'</p>');

            //     }

            //     return;
            // }


            fetch('/user/create',{
                method : 'POST',
                credentials : 'same-origin',
                headers : {
                    'Content-Type' : 'application/json'
                }, 
                body : JSON.stringify(fields)
            })
            .then(resp => {
                return resp.json();
            })
            .then(resp => {
                if(resp.errors){
                    console.log('errors');
                    errbox.innerHTML = '';
                    for(error of resp.errors){
                        errbox.insertAdjacentHTML('beforeend','<p>'+error.msg+'</p>');
                    }
                    throw new Error();
                }else{

                      console.log('it works!');

                }
            })
            .catch(err => {
                console.log(err);
            });
        });

When I am running this code, the else block is not running. Is this a bug in the Chrome browser or something?

Microsoft Edge is showing an ‘unspecified error’.

Ok, I finally figured it out! I forgot to send a response from the server. Sorry!