Unfortunately that is a very common mistake and if it makes you feel any better you are not the only one who has experienced that by far. I had a pet rabbit that came close to having that happen myself (It chewed several lamp cords and somehow no one got shocked but easily could have been). Learning things the hard way is part of pet ownership, sad, but true. The truth is that there is nothing anyone can do to prevent all accidents especially with these animals that are very fast, quiet, and fragile. So be aware because accidents like this can happen to anyone and in unexpected ways.
Another thing you might want to do to help prevent commonly occurring accidents, other than letting your chinchillas play only in rooms prepared for them, is to consider these common hazards I have seen cause problems and deaths on this board.
1. Wire hay balls or feeders that have wire racks. Chinchillas get their heads caught in these occasionally and can die.
2. Wire shelving or ramps that chinchillas jump off of. This is a very common source of fractures which often result in fatal complications.
3. Plastic or cloth items in the cage. These can be chewed and cause lacerations or bowel obstructions. The exception is to this is woven "fleece" items but only as long as the chinchilla does not have a habit of chewing them.
4. Any kind of door in the room can be extremely hazardous if opened or shut near the animal for obvious reasons.
5. When picking up your chinchilla make sure it does not panic and flail around. It must be secured well even if it doesn't like it. Best practice is to stabilize it by the base of the tail and under the chest area at all times when handling. The flailing of a panicked chinchilla can cause serious joint and muscle trauma. (I don't always observe this with mine but he's extremely tame)
6. Always consider that a chinchilla can be right under your feet without you knowing it when it is out.
7. Wires that can stick out that the chinchilla can chew on or get scraped on. Remember that chinchillas are very sensitive to pain and can die from shock if it's bad enough.
8. Food must be checked for moisture and mold. If it's suspect do not feed it to a chinchilla. Anything moldy can cause poisoning and possibly infections if ingested or inhaled.
9. Do not use Febreeze, bleach, or aerosols around a chinchilla. This can easily result in instant fatal pneumonia.
Another accident that I know of here was pretty recent but is the only case I know of like it. This chinchilla was playing in a blanket and got its leg caught resulting in a fracture with possible severe injuries to the joints and muscle. It was a freak accident but I recommend that if you use a blanket that it's not woven material that it can get caught in. I don't know much other than it happened.
I am sorry for your loss and I hope it goes better with your other chinchilla.