Cleanup node code by categorizing errors