It's kind of difficult not knowing about your husbandry or the background of the snake. If I had had to guess from your description I'd say dehydration, based on trouble shedding, loss of appetite, and not being able to digest when it finally did eat. The only way to know for sure is to have a vet do a necropsy (animal autopsy).