c4milo/node-libvirt — pull request #22 by dohpaz42 (2013-05-15 13:21:30+00:00)
Title: Change Domain::GetId so it only throws an exception when an actual error occurs

Instead of blanketly throwing an exception when virDomainGetId returns -1, check to see if an actual error object exists in virGetLastError; if it does, then throw the exception as normal, and if it doesn't then just return null. This will allow the caller to handle a null domain id without having to clutter up the code with try/catch blocks for situations that might not be exceptional (i.e., the domain is simply not running).